Housekeeper/pkg/util/epoch.go

13 lines
308 B
Go
Raw Permalink Normal View History

2018-11-14 03:51:03 +00:00
package util
import "time"
2018-11-15 05:34:24 +00:00
// SubtractedEpoch will take the current time in epoch and subtract (days) worth of seconds from the current epoch time.
2018-11-14 03:51:03 +00:00
func SubtractedEpoch(days int) int64 {
now := time.Now()
unix := now.Unix()
seconds := int64(days * 86400)
epoch := int64(unix - seconds)
return epoch
}