Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3804)

Side by Side Diff: src/pkg/os/time.go

Issue 5372080: code review 5372080: syscall: use error (Closed)
Patch Set: diff -r 25e37de63f5d https://go.googlecode.com/hg/ Created 13 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pkg/os/sys_windows.go ('k') | src/pkg/os/user/lookup_unix.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package os 5 package os
6 6
7 import "syscall" 7 import "syscall"
8 8
9 // Time returns the current time, in whole seconds and 9 // Time returns the current time, in whole seconds and
10 // fractional nanoseconds, plus an error if any. The current 10 // fractional nanoseconds, plus an error if any. The current
11 // time is thus 1e9*sec+nsec, in nanoseconds. The zero of 11 // time is thus 1e9*sec+nsec, in nanoseconds. The zero of
12 // time is the Unix epoch. 12 // time is the Unix epoch.
13 func Time() (sec int64, nsec int64, err error) { 13 func Time() (sec int64, nsec int64, err error) {
14 var tv syscall.Timeval 14 var tv syscall.Timeval
15 » if e := syscall.Gettimeofday(&tv); iserror(e) { 15 » if e := syscall.Gettimeofday(&tv); e != nil {
16 return 0, 0, NewSyscallError("gettimeofday", e) 16 return 0, 0, NewSyscallError("gettimeofday", e)
17 } 17 }
18 return int64(tv.Sec), int64(tv.Usec) * 1000, err 18 return int64(tv.Sec), int64(tv.Usec) * 1000, err
19 } 19 }
OLDNEW
« no previous file with comments | « src/pkg/os/sys_windows.go ('k') | src/pkg/os/user/lookup_unix.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b