fix 定时器周变更事件
This commit is contained in:
parent
0edc943ede
commit
b98c74c983
|
@ -122,9 +122,9 @@ func (this *ClockMgr) Update() {
|
|||
this.LastDay = day
|
||||
this.fireDayEvent()
|
||||
|
||||
week := GetWeekStartTs(tNow.Unix())
|
||||
if week != int64(this.LastWeek) {
|
||||
this.LastWeek = int(week)
|
||||
_, week := tNow.ISOWeek()
|
||||
if week != this.LastWeek {
|
||||
this.LastWeek = week
|
||||
this.fireWeekEvent()
|
||||
}
|
||||
|
||||
|
|
|
@ -76,8 +76,12 @@ func InSameWeek(tNow, tPre time.Time) bool {
|
|||
if tPre.IsZero() {
|
||||
return true
|
||||
}
|
||||
|
||||
if GetWeekStartTs(tNow.Unix()) == GetWeekStartTs(tPre.Unix()) {
|
||||
y1, w1 := tNow.ISOWeek()
|
||||
y2, w2 := tPre.ISOWeek()
|
||||
if y1 != y2 {
|
||||
return false
|
||||
}
|
||||
if w1 == w2 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
|
Loading…
Reference in New Issue