|
|
- package schedule
-
- import "time"
-
- // 用于日模型的线段,相对时间
- type LineSegementSrv struct {
- WorkShiftNr int // 人员班组编号
- StartSecond int // 基于0点的起始秒数
- EndSecond int // 基于0点的起始秒数
- Duration time.Duration
- }
-
- // 获取线段的持续时间
- func (lss *LineSegementSrv) GetDuration() time.Duration {
- if lss.StartSecond > lss.EndSecond {
- lss.Duration = time.Duration(0)
- } else {
- lss.Duration = time.Duration(lss.EndSecond - lss.StartSecond)
- }
- return lss.Duration
- }
|