summaryrefslogtreecommitdiff
path: root/src/pkg/syscall/syscall.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/syscall/syscall.go')
-rw-r--r--src/pkg/syscall/syscall.go23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/pkg/syscall/syscall.go b/src/pkg/syscall/syscall.go
index 9f777f59e..335559fc3 100644
--- a/src/pkg/syscall/syscall.go
+++ b/src/pkg/syscall/syscall.go
@@ -9,8 +9,9 @@
// packages rather than this one if you can.
// For details of the functions and data types in this package consult
// the manuals for the appropriate operating system.
-// These calls return errno == 0 to indicate success; otherwise
-// errno is an operating system error number describing the failure.
+// These calls return err == nil to indicate success; otherwise
+// err is an operating system error describing the failure.
+// On most systems, that error has type syscall.Errno.
package syscall
// StringByteSlice returns a NUL-terminated slice of bytes
@@ -26,5 +27,21 @@ func StringByteSlice(s string) []byte {
func StringBytePtr(s string) *byte { return &StringByteSlice(s)[0] }
// Single-word zero for use when we need a valid pointer to 0 bytes.
-// See mksyscall.sh.
+// See mksyscall.pl.
var _zero uintptr
+
+func (ts *Timespec) Unix() (sec int64, nsec int64) {
+ return int64(ts.Sec), int64(ts.Nsec)
+}
+
+func (tv *Timeval) Unix() (sec int64, nsec int64) {
+ return int64(tv.Sec), int64(tv.Usec) * 1000
+}
+
+func (ts *Timespec) Nano() int64 {
+ return int64(ts.Sec)*1e9 + int64(ts.Nsec)
+}
+
+func (tv *Timeval) Nano() int64 {
+ return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000
+}