1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2023 The rust-ggstd authors.
// 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.
use ;
// //go:build unix || (js && wasm)
// // timespec_to_nsec returns the time stored in ts as nanoseconds.
// fn timespec_to_nsec(ts Timespec) i64 { return ts.Nano() }
/// nsec_to_timespec converts a number of nanoseconds into a Timespec.
// // TimevalToNsec returns the time stored in tv as nanoseconds.
// fn TimevalToNsec(tv Timeval) i64 { return tv.Nano() }
// // NsecToTimeval converts a number of nanoseconds into a Timeval.
// fn NsecToTimeval(nsec i64) Timeval {
// nsec += 999 // round up to microsecond
// usec := nsec % 1e9 / 1e3
// sec := nsec / 1e9
// if usec < 0 {
// usec += 1e6
// sec--
// }
// return setTimeval(sec, usec)
// }