Skip to content

Commit

Permalink
fix leap file expiration and update times
Browse files Browse the repository at this point in the history
This fixes a bug causing leap file expiration date
to be off by 70 years and update date to be outdated

Signed-off-by: Vitaly Grinberg <[email protected]>
  • Loading branch information
Vitaly Grinberg authored and josephdrichard committed Jun 15, 2024
1 parent 49b3c4d commit c729a88
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/daemon/leap/leap-file.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (l *LeapManager) PopulateLeapData() error {
l.leapFile = *leapData
// Set expiration time to 2036
exp := time.Date(2036, time.January, 1, 0, 0, 0, 0, time.UTC)
start := time.Date(1970, time.January, 1, 0, 0, 0, 0, time.UTC)
start := time.Date(1900, time.January, 1, 0, 0, 0, 0, time.UTC)
expSec := int(exp.Sub(start).Seconds())
l.leapFile.ExpirationTime = fmt.Sprint(expSec)
data, err := l.RenderLeapData()
Expand Down Expand Up @@ -212,6 +212,7 @@ func (l *LeapManager) AddLeapEvent(leapTime time.Time,
leapTime.Day(), leapTime.Month().String()[:3], leapTime.Year()),
}
l.leapFile.LeapEvents = append(l.leapFile.LeapEvents, ev)
l.leapFile.UpdateTime = fmt.Sprint(int(currentTime.Sub(startTime).Seconds()))
l.RehashLeapData()

}
Expand Down

0 comments on commit c729a88

Please sign in to comment.