Skip to content

Commit 105b5f0

Browse files
committed
std: Expand doc comments for time module
1 parent 123a920 commit 105b5f0

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

src/libstd/time.rs

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,46 @@
22
Module: time
33
*/
44

5-
// FIXME: Document what these functions do
6-
75
#[abi = "cdecl"]
86
native mod rustrt {
97
fn get_time(&sec: u32, &usec: u32);
108
fn nano_time(&ns: u64);
119
}
1210

13-
/* Type: timeval */
11+
/*
12+
Type: timeval
13+
14+
A record specifying a time value in seconds and microseconds.
15+
*/
1416
type timeval = {sec: u32, usec: u32};
1517

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+
*/
1724
fn get_time() -> timeval {
1825
let sec = 0u32;
1926
let usec = 0u32;
2027
rustrt::get_time(sec, usec);
2128
ret {sec: sec, usec: usec};
2229
}
2330

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+
*/
2537
fn precise_time_ns() -> u64 { let ns = 0u64; rustrt::nano_time(ns); ret ns; }
2638

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+
*/
2845
fn precise_time_s() -> float {
2946
ret (precise_time_ns() as float) / 1000000000.;
3047
}

0 commit comments

Comments
 (0)