From 9b75c7466024689ea3e33d308911720205a83cb7 Mon Sep 17 00:00:00 2001 From: shoopea Date: Thu, 9 May 2019 11:08:50 +0800 Subject: [PATCH] test --- def.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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")