Skip to content

Commit

Permalink
Merge pull request #91 from adelolmo/fix-skew-time
Browse files Browse the repository at this point in the history
Use UNIX time to calculate skew interval
  • Loading branch information
adelolmo authored Feb 6, 2023
2 parents ce6c97b + d53a8a3 commit 1371941
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 1371941

Please sign in to comment.