Skip to content

Commit

Permalink
fix select shift
Browse files Browse the repository at this point in the history
  • Loading branch information
lynxzp committed Jan 4, 2022
1 parent 1c49006 commit 2f36124
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion collector/sources/pkg/shift/shift.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func GetCurrentShift() int {
// return 3
//}
//return 0
t := time.Time{}
t := time.Now()
for i := range config.Cfg.Shifts {
if t.AfterOrEqual(config.Cfg.Shifts[i].Start) && t.BeforeOrEqual(config.Cfg.Shifts[i].Finish) {
return config.Cfg.Shifts[i].Number
Expand Down
9 changes: 9 additions & 0 deletions collector/sources/pkg/time/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package time
import (
"log"
"strconv"
systemT "time"
)

type Time struct {
Expand Down Expand Up @@ -49,3 +50,11 @@ func (t1 *Time) AfterOrEqual(t2 Time) bool {
}
return false
}

func Now() Time {
ownT := Time{}
sysT := systemT.Now()
ownT.hours = sysT.Hour()
ownT.minutes = sysT.Minute()
return ownT
}

0 comments on commit 2f36124

Please sign in to comment.