File tree Expand file tree Collapse file tree 1 file changed +23
-6
lines changed Expand file tree Collapse file tree 1 file changed +23
-6
lines changed Original file line number Diff line number Diff line change 2
2
Module: time
3
3
*/
4
4
5
- // FIXME: Document what these functions do
6
-
7
5
#[ abi = "cdecl" ]
8
6
native mod rustrt {
9
7
fn get_time ( & sec: u32 , & usec: u32 ) ;
10
8
fn nano_time ( & ns: u64 ) ;
11
9
}
12
10
13
- /* Type: timeval */
11
+ /*
12
+ Type: timeval
13
+
14
+ A record specifying a time value in seconds and microseconds.
15
+ */
14
16
type timeval = { sec : u32 , usec : u32 } ;
15
17
16
- /* Function: get_time */
18
+ /*
19
+ Function: get_time
20
+
21
+ Returns the current time as a `timeval` containing the seconds and
22
+ microseconds since 1970-01-01T00:00:00Z.
23
+ */
17
24
fn get_time ( ) -> timeval {
18
25
let sec = 0u32 ;
19
26
let usec = 0u32 ;
20
27
rustrt:: get_time ( sec, usec) ;
21
28
ret { sec : sec, usec : usec} ;
22
29
}
23
30
24
- /* Function: precise_time_ns */
31
+ /*
32
+ Function: precise_time_ns
33
+
34
+ Returns the current value of a high-resolution performance counter
35
+ in nanoseconds since an unspecified epoch.
36
+ */
25
37
fn precise_time_ns ( ) -> u64 { let ns = 0u64 ; rustrt:: nano_time ( ns) ; ret ns; }
26
38
27
- /* Function: precise_time_s */
39
+ /*
40
+ Function: precise_time_s
41
+
42
+ Returns the current value of a high-resolution performance counter
43
+ in seconds since an unspecified epoch.
44
+ */
28
45
fn precise_time_s ( ) -> float {
29
46
ret ( precise_time_ns ( ) as float ) / 1000000000. ;
30
47
}
You can’t perform that action at this time.
0 commit comments