21 lines
338 B
Go
21 lines
338 B
Go
|
package data_updater
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func calculateTime() int64 {
|
||
|
now := time.Now()
|
||
|
|
||
|
targetTime := time.Date(now.Year(), now.Month(), now.Day(), 4, 0, 0, 0, now.Location())
|
||
|
|
||
|
if now.After(targetTime) {
|
||
|
targetTime = targetTime.AddDate(0, 0, 1)
|
||
|
}
|
||
|
|
||
|
toTarget := targetTime.Sub(now)
|
||
|
sec := int64(toTarget.Seconds())
|
||
|
|
||
|
return sec
|
||
|
}
|