Skip to content

Commit

Permalink
Fix bug that caused first day in new year to be 0 when transitioning …
Browse files Browse the repository at this point in the history
…into the new year
  • Loading branch information
wolf81 committed Jun 5, 2020
1 parent 5f09e76 commit 08cc7a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Harptos/Internal/Calendar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Calendar {
let leapDaySeconds = Float(year) / 4 * Float(Constants.secondsPerDay)
let remainingYearSeconds = epoch - (year * Constants.secondsPerYear) - Int(leapDaySeconds)
var day = Int(remainingYearSeconds / Constants.secondsPerDay)
if day == 0 { day = 1} // if we've arrived in a new year, start on day 1
if day == 0 { day = 1 } // if we've arrived in a new year, start on day 1

var segment: YearTimeSegment = YearTimeSegment.allCases.first!

Expand All @@ -37,7 +37,7 @@ class Calendar {

if isLeapYear(year) == false && aSegment == .shieldmeet { continue }

if day >= segmentDays {
if day > segmentDays {
day -= segmentDays
} else {
break
Expand Down

0 comments on commit 08cc7a2

Please sign in to comment.