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.

18 lines
306 B

  1. package udptransfer
  2. import "time"
  3. const Millisecond = 1e6
  4. func Now() int64 {
  5. return time.Now().UnixNano()/Millisecond
  6. }
  7. func NowNS() int64 {
  8. return time.Now().UnixNano()
  9. }
  10. func NewTimerChan(d int64) <-chan time.Time {
  11. ticker := time.NewTimer(time.Duration(d) * time.Millisecond)
  12. return ticker.C
  13. }