Source File
timestruct.go
Belonging Package
syscall
// 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.
//go:build unix || (js && wasm) || wasip1
package syscall
// TimespecToNsec returns the time stored in ts as nanoseconds.
func ( Timespec) int64 { return .Nano() }
// NsecToTimespec converts a number of nanoseconds into a Timespec.
func ( int64) Timespec {
:= / 1e9
= % 1e9
if < 0 {
+= 1e9
--
}
return setTimespec(, )
}
// TimevalToNsec returns the time stored in tv as nanoseconds.
func ( Timeval) int64 { return .Nano() }
// NsecToTimeval converts a number of nanoseconds into a Timeval.
func ( int64) Timeval {
+= 999 // round up to microsecond
:= % 1e9 / 1e3
:= / 1e9
if < 0 {
+= 1e6
--
}
return setTimeval(, )
}
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |