summaryrefslogtreecommitdiff
path: root/libgo/go/time/sleep.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/time/sleep.go')
-rw-r--r--libgo/go/time/sleep.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/libgo/go/time/sleep.go b/libgo/go/time/sleep.go
index 1e23118f378..b4680db2387 100644
--- a/libgo/go/time/sleep.go
+++ b/libgo/go/time/sleep.go
@@ -4,6 +4,9 @@
package time
+// Sleep pauses the current goroutine for the duration d.
+func Sleep(d Duration)
+
func nano() int64 {
sec, nsec := now()
return sec*1e9 + int64(nsec)
@@ -72,13 +75,13 @@ func After(d Duration) <-chan Time {
return NewTimer(d).C
}
-// AfterFunc waits at least ns nanoseconds before calling f
+// AfterFunc waits for the duration to elapse and then calls f
// in its own goroutine. It returns a Timer that can
// be used to cancel the call using its Stop method.
-func AfterFunc(ns int64, f func()) *Timer {
+func AfterFunc(d Duration, f func()) *Timer {
t := &Timer{
r: runtimeTimer{
- when: nano() + ns,
+ when: nano() + int64(d),
f: goFunc,
arg: f,
},