aboutsummaryrefslogtreecommitdiff
path: root/src/syscall/timestruct.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2016-10-11 14:20:50 -0700
committerIan Lance Taylor <iant@golang.org>2016-10-11 22:58:57 +0000
commit7f6eadb64fb16e73b15630dd3089edc568d047cb (patch)
treef606425c8941b90045f16df5fff4ea6590b142b1 /src/syscall/timestruct.go
parente1fc292500aa70c265937aebad00ac010031cbaf (diff)
downloadgo-7f6eadb64fb16e73b15630dd3089edc568d047cb.tar.xz
syscall: unify TimespecToNsec and TimevalToNsec
All implementations of these functions are identical. Change-Id: I7cbea53c02bb0cee75e30beed19d29ba0a7ef657 Reviewed-on: https://go-review.googlesource.com/30819 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/syscall/timestruct.go')
-rw-r--r--src/syscall/timestruct.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/syscall/timestruct.go b/src/syscall/timestruct.go
new file mode 100644
index 0000000000..4c4e204916
--- /dev/null
+++ b/src/syscall/timestruct.go
@@ -0,0 +1,11 @@
+// Copyright 2016 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
+
+package syscall
+
+func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
+
+func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }