@@ -5,20 +5,6 @@ use libc::{c_char, c_int, c_long, size_t, time_t};
5
5
use io:: { Reader , ReaderUtil } ;
6
6
use result:: { Result , Ok , Err } ;
7
7
8
- export
9
- Timespec ,
10
- get_time,
11
- precise_time_ns,
12
- precise_time_s,
13
- tzset,
14
- Tm ,
15
- empty_tm,
16
- now,
17
- at,
18
- now_utc,
19
- at_utc,
20
- strptime;
21
-
22
8
#[ abi = "cdecl" ]
23
9
extern mod rustrt {
24
10
#[ legacy_exports] ;
@@ -34,7 +20,7 @@ extern mod rustrt {
34
20
}
35
21
36
22
/// A record specifying a time value in seconds and nanoseconds.
37
- type Timespec = { sec : i64 , nsec : i32 } ;
23
+ pub type Timespec = { sec : i64 , nsec : i32 } ;
38
24
39
25
impl Timespec : Eq {
40
26
pure fn eq ( other : & Timespec ) -> bool {
@@ -47,7 +33,7 @@ impl Timespec : Eq {
47
33
* Returns the current time as a `timespec` containing the seconds and
48
34
* nanoseconds since 1970-01-01T00:00:00Z.
49
35
*/
50
- fn get_time ( ) -> Timespec {
36
+ pub fn get_time ( ) -> Timespec {
51
37
let mut sec = 0i64 ;
52
38
let mut nsec = 0i32 ;
53
39
rustrt:: get_time ( sec, nsec) ;
@@ -58,7 +44,7 @@ fn get_time() -> Timespec {
58
44
* Returns the current value of a high-resolution performance counter
59
45
* in nanoseconds since an unspecified epoch.
60
46
*/
61
- fn precise_time_ns ( ) -> u64 {
47
+ pub fn precise_time_ns ( ) -> u64 {
62
48
let mut ns = 0u64 ;
63
49
rustrt:: precise_time_ns ( ns) ;
64
50
ns
@@ -68,11 +54,11 @@ fn precise_time_ns() -> u64 {
68
54
* Returns the current value of a high-resolution performance counter
69
55
* in seconds since an unspecified epoch.
70
56
*/
71
- fn precise_time_s ( ) -> float {
57
+ pub fn precise_time_s ( ) -> float {
72
58
return ( precise_time_ns ( ) as float ) / 1000000000. ;
73
59
}
74
60
75
- fn tzset ( ) {
61
+ pub fn tzset ( ) {
76
62
rustrt:: rust_tzset ( ) ;
77
63
}
78
64
@@ -109,7 +95,7 @@ impl Tm_ : Eq {
109
95
pure fn ne ( other : & Tm_ ) -> bool { !self . eq ( other) }
110
96
}
111
97
112
- enum Tm {
98
+ pub enum Tm {
113
99
Tm_ ( Tm_ )
114
100
}
115
101
@@ -118,7 +104,7 @@ impl Tm : Eq {
118
104
pure fn ne ( other : & Tm ) -> bool { * self != * ( * other) }
119
105
}
120
106
121
- fn empty_tm ( ) -> Tm {
107
+ pub fn empty_tm ( ) -> Tm {
122
108
Tm_ ( {
123
109
tm_sec: 0_i32 ,
124
110
tm_min: 0_i32 ,
@@ -136,33 +122,33 @@ fn empty_tm() -> Tm {
136
122
}
137
123
138
124
/// Returns the specified time in UTC
139
- fn at_utc ( clock : Timespec ) -> Tm {
125
+ pub fn at_utc ( clock : Timespec ) -> Tm {
140
126
let mut { sec, nsec} = clock;
141
127
let mut tm = empty_tm ( ) ;
142
128
rustrt:: rust_gmtime ( sec, nsec, tm) ;
143
129
tm
144
130
}
145
131
146
132
/// Returns the current time in UTC
147
- fn now_utc ( ) -> Tm {
133
+ pub fn now_utc ( ) -> Tm {
148
134
at_utc ( get_time ( ) )
149
135
}
150
136
151
137
/// Returns the specified time in the local timezone
152
- fn at ( clock : Timespec ) -> Tm {
138
+ pub fn at ( clock : Timespec ) -> Tm {
153
139
let mut { sec, nsec} = clock;
154
140
let mut tm = empty_tm ( ) ;
155
141
rustrt:: rust_localtime ( sec, nsec, tm) ;
156
142
tm
157
143
}
158
144
159
145
/// Returns the current time in the local timezone
160
- fn now ( ) -> Tm {
146
+ pub fn now ( ) -> Tm {
161
147
at ( get_time ( ) )
162
148
}
163
149
164
150
/// Parses the time from the string according to the format string.
165
- fn strptime ( s : & str , format : & str ) -> Result < Tm , ~str > {
151
+ pub fn strptime ( s : & str , format : & str ) -> Result < Tm , ~str > {
166
152
type TmMut = {
167
153
mut tm_sec : i32 ,
168
154
mut tm_min : i32 ,
0 commit comments