1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
10 // Time returns the current time, in whole seconds and
11 // fractional nanoseconds, plus an Error if any. The current
12 // time is thus 1e9*sec+nsec, in nanoseconds. The zero of
13 // time is the Unix epoch.
14 func Time() (sec
int64, nsec
int64, err Error
) {
15 var tv syscall
.Timeval
16 if errno
:= syscall
.Gettimeofday(&tv
); errno
!= 0 {
17 return 0, 0, NewSyscallError("gettimeofday", errno
)
19 return int64(tv
.Sec
), int64(tv
.Usec
) * 1000, err