1 Star 0 Fork 0

kzangv/gsf-fof

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
delay.go 393 Bytes
Copy Edit Raw Blame History
kzangv authored 2023-02-23 10:22 . fixed
package schedule
import (
"time"
)
type delay struct {
delay time.Duration
}
func (s *delay) Next(t time.Time) *time.Time {
v := t.Add(s.delay - time.Duration(t.Nanosecond())*time.Nanosecond)
return &v
}
func NewDelaySchedule(sec int) Interface {
duration := time.Second * time.Duration(sec)
return &delay{
delay: duration - time.Duration(duration.Nanoseconds())%time.Second,
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/kzangv/gsf-fof.git
git@gitee.com:kzangv/gsf-fof.git
kzangv
gsf-fof
gsf-fof
v0.2.7

Search