-
Notifications
You must be signed in to change notification settings - Fork 5
/
funcs_disabled.go
31 lines (21 loc) · 1.02 KB
/
funcs_disabled.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// +build timex_disable
package timex
import (
"time"
)
// Now can be used as a replacement of time.Now()
func Now() time.Time { return time.Now() }
// Since can be used as a replacement of time.Since()
func Since(t time.Time) time.Duration { return time.Since(t) }
// Until can be used as a replacement of time.Until()
func Until(t time.Time) time.Duration { return time.Until(t) }
// Sleep can be used as a replacement of time.Sleep()
func Sleep(d time.Duration) { time.Sleep(d) }
// After can be used a replacement of time.After()
func After(d time.Duration) <-chan time.Time { return time.After(d) }
// AfterFunc can be used as a replacement of time.AfterFunc()
func AfterFunc(d time.Duration, f func()) Timer { return timer{time.AfterFunc(d, f)} }
// NewTicker creates a new ticker as a replacement of time.NewTicker
func NewTicker(d time.Duration) Ticker { return ticker{time.NewTicker(d)} }
// NewTimer creates a new timer as a replacement of time.NewTimer
func NewTimer(d time.Duration) Timer { return timer{time.NewTimer(d)} }