diff --git a/def.go b/def.go index 3ba3392..91eeda1 100644 --- a/def.go +++ b/def.go @@ -4,6 +4,7 @@ import ( "errors" "log" "regexp" + "strconv" "time" ) @@ -120,9 +121,9 @@ func fromChatWarsDate(d string) (t time.Time, err error) { } t, _ := time.Parse(time.RFC3339, "2018-01-31T00:00:00+00:00") t = t.AddDate(0, 0, (days / 3)) - t = t.Add((days % 3) * 8 * time.Hour) - t = t.Add(strconv.Atoi(r.ReplaceAllString(d, "${Hour}")) * 20 * time.Minute) - t = t.Add(strconv.Atoi(r.ReplaceAllString(d, "${Minute}")) * 20 * time.Second) + t = t.Add(time.Hour * ((days % 3) * 8)) + t = t.Add(time.Minute * (strconv.Atoi(r.ReplaceAllString(d, "${Hour}")) * 20)) + t = t.Add(time.Second * (strconv.Atoi(r.ReplaceAllString(d, "${Minute}")) * 20)) return t, nil } else { return time.Now(), errors.New("Wrong format")