diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-01-12 01:31:45 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-01-12 01:31:45 +0000 |
commit | 9a0e3259f44ad2de9c65f14f756dab01b3598391 (patch) | |
tree | 86a3b8019380d5fad53258c4baba3dd9e1e7c736 /libgo/go/time/sleep.go | |
parent | c6135f063335419e4b5df0b4e1caf145882c8a4b (diff) | |
download | gcc-9a0e3259f44ad2de9c65f14f756dab01b3598391.zip gcc-9a0e3259f44ad2de9c65f14f756dab01b3598391.tar.gz gcc-9a0e3259f44ad2de9c65f14f756dab01b3598391.tar.bz2 |
libgo: Update to weekly.2011-12-14.
From-SVN: r183118
Diffstat (limited to 'libgo/go/time/sleep.go')
-rw-r--r-- | libgo/go/time/sleep.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libgo/go/time/sleep.go b/libgo/go/time/sleep.go index 1e23118..b4680db 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, }, |