diff options
Diffstat (limited to 'libgo/go/time/sys.go')
-rw-r--r-- | libgo/go/time/sys.go | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/libgo/go/time/sys.go b/libgo/go/time/sys.go index 4bc9253..ca1d334 100644 --- a/libgo/go/time/sys.go +++ b/libgo/go/time/sys.go @@ -4,27 +4,17 @@ package time -import "os" - // Seconds reports the number of seconds since the Unix epoch, // January 1, 1970 00:00:00 UTC. func Seconds() int64 { - sec, _, err := os.Time() - if err != nil { - panic(err) - } - return sec + return Nanoseconds() / 1e9 } +// Nanoseconds is implemented by package runtime. + // Nanoseconds reports the number of nanoseconds since the Unix epoch, // January 1, 1970 00:00:00 UTC. -func Nanoseconds() int64 { - sec, nsec, err := os.Time() - if err != nil { - panic(err) - } - return sec*1e9 + nsec -} +func Nanoseconds() int64 // Sleep pauses the current goroutine for at least ns nanoseconds. // Higher resolution sleeping may be provided by syscall.Nanosleep |