From d148ea24457d687045f7e54e7d6e89f9a4f0f278 Mon Sep 17 00:00:00 2001 From: eson <474420502@qq.com> Date: Wed, 2 Jan 2019 01:59:34 +0800 Subject: [PATCH 1/3] add uid print --- crontab.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crontab.go b/crontab.go index 7d7a424..164a776 100644 --- a/crontab.go +++ b/crontab.go @@ -9,6 +9,8 @@ import ( "strings" "time" + "github.com/satori/go.uuid" + "474420502.top/eson/structure/circular_linked" "github.com/Pallinder/go-randomdata" @@ -42,6 +44,7 @@ func (force *Force) NextTime() time.Time { type Crontab struct { crontab string + uid uuid.UUID force *Force min []timePointer @@ -166,6 +169,12 @@ func (cron *Crontab) String() string { func (cron *Crontab) FromString(crontab string) error { crontab = cron.crontab + uid, err := uuid.NewV4() + if err != nil { + panic(err) + } + cron.uid = uid + cron.interval = nil cron.min = nil cron.hour = nil @@ -295,7 +304,7 @@ func (cron *Crontab) intervalCalculateNextTime(now time.Time) { } - log.Println("success:", cron.trueCount, "count time wait:", isecond, "s") + fmt.Println(cron.uid.String(), "success:", cron.trueCount, " wait:", isecond) } else { @@ -313,7 +322,7 @@ func (cron *Crontab) intervalCalculateNextTime(now time.Time) { } } - log.Println("fail:", cron.failCount, "count time wait:", isecond, "s") + fmt.Println(cron.uid.String(), "fail:", cron.failCount, " wait:", isecond) } iv.Count-- From b54c0cf45cb281f7d41eac03aa16137fd686e934 Mon Sep 17 00:00:00 2001 From: eson <474420502@qq.com> Date: Wed, 2 Jan 2019 02:03:58 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crontab.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crontab.go b/crontab.go index 164a776..ba78c05 100644 --- a/crontab.go +++ b/crontab.go @@ -304,7 +304,7 @@ func (cron *Crontab) intervalCalculateNextTime(now time.Time) { } - fmt.Println(cron.uid.String(), "success:", cron.trueCount, " wait:", isecond) + fmt.Println(time.Now(), cron.uid.String(), "success:", cron.trueCount, " wait:", isecond) } else { @@ -322,7 +322,7 @@ func (cron *Crontab) intervalCalculateNextTime(now time.Time) { } } - fmt.Println(cron.uid.String(), "fail:", cron.failCount, " wait:", isecond) + fmt.Println(time.Now(), cron.uid.String(), "fail:", cron.failCount, " wait:", isecond) } iv.Count-- From 9d57144934a3570a843f2ca0b597e93ffdf65296 Mon Sep 17 00:00:00 2001 From: eson <474420502@qq.com> Date: Wed, 2 Jan 2019 03:03:28 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E9=97=B4=E6=9B=B4=E5=AE=A2=E8=A7=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crontab.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crontab.go b/crontab.go index ba78c05..9694a90 100644 --- a/crontab.go +++ b/crontab.go @@ -304,7 +304,7 @@ func (cron *Crontab) intervalCalculateNextTime(now time.Time) { } - fmt.Println(time.Now(), cron.uid.String(), "success:", cron.trueCount, " wait:", isecond) + fmt.Println(time.Now().Format("01-02 15:04:05"), cron.uid.String(), "success:", cron.trueCount, " wait:", isecond) } else { @@ -322,7 +322,7 @@ func (cron *Crontab) intervalCalculateNextTime(now time.Time) { } } - fmt.Println(time.Now(), cron.uid.String(), "fail:", cron.failCount, " wait:", isecond) + fmt.Println(time.Now().Format("01-02 15:04:05"), cron.uid.String(), "fail:", cron.failCount, " wait:", isecond) } iv.Count--