correr a las 8 am

This commit is contained in:
Cat /dev/Nulo 2023-05-31 17:15:27 -03:00
parent 9456c5e37f
commit 0f6bd3c7e3

View file

@ -38,9 +38,11 @@ func main() {
cycle()
}
const timezoneOffset = -3
func cycle() {
now := time.Now()
lastWeek := now.Add(-time.Hour * 24 * time.Duration(now.Weekday()-time.Monday))
lastWeek := now.Add(-time.Hour*24*time.Duration(now.Weekday()-time.Monday) + 8 - timezoneOffset)
if now.Weekday() > time.Sunday {
err := createIfNotExists(lastWeek.Format("semana 2006-01-02"))
if err != nil {
@ -48,7 +50,7 @@ func cycle() {
}
}
time.Sleep(time.Hour * 5)
time.Sleep(time.Minute * 10)
cycle()
}