You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

20 lines
486 B

package schedule
import "time"
// 用于日模型的线段,相对时间
type LineSegementSrv struct {
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
}