Skip to content

Commit

Permalink
Fix integer overflow converting Lunar to Gregorian on 386 arch (#220)
Browse files Browse the repository at this point in the history
Fix integer overflow converting Lunar to Gregorian on 386 arch (#220)
  • Loading branch information
gouguoyin authored Jan 25, 2024
2 parents 28091bd + a163127 commit 0e710e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions calendar/lunar/lunar.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ func (l Lunar) ToGregorian() (g Gregorian) {
offset += days
}

ts := (offset+l.day)*86400 + -2206512000 + l.hour*3600 + l.minute*60 + l.second
g.Time = time.Unix(int64(ts), 0)
ts := (int64(offset)+int64(l.day))*86400 + int64(-2206512000) + int64(l.hour)*3600 + int64(l.minute)*60 + int64(l.second)
g.Time = time.Unix(ts, 0)
return g
}

Expand Down

0 comments on commit 0e710e7

Please sign in to comment.