Skip to content

Commit

Permalink
fixes #81 Use UNIX time to calculate skew interval
Browse files Browse the repository at this point in the history
  • Loading branch information
adelolmo committed Feb 6, 2023
1 parent ce6c97b commit d53a8a3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hdidle.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ func updateState(tmp DiskStats, config *Config) {
return
}

if now.Sub(lastNow) > config.SkewTime {
intervalDurationInSeconds := now.Unix() - lastNow.Unix()
if intervalDurationInSeconds > config.SkewTime.Milliseconds()/1000 {
/* we slept too long, assume a suspend event and disks may be spun up */
/* reset spin status and timers */
previousSnapshots[dsi].SpinUpAt = now
Expand Down

0 comments on commit d53a8a3

Please sign in to comment.