1
- // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1
+ // Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2
2
// file at the top-level directory of this distribution and at
3
3
// http://rust-lang.org/COPYRIGHT.
4
4
//
@@ -22,11 +22,11 @@ pub mod rustrt {
22
22
pub unsafe fn precise_time_ns ( ns : & mut u64 ) ;
23
23
24
24
pub unsafe fn rust_tzset ( ) ;
25
- // FIXME: The i64 values can be passed by-val when #2064 is fixed.
25
+
26
26
pub unsafe fn rust_gmtime ( sec : i64 , nsec : i32 , result : & mut Tm ) ;
27
27
pub unsafe fn rust_localtime ( sec : i64 , nsec : i32 , result : & mut Tm ) ;
28
- pub unsafe fn rust_timegm ( tm : & Tm , sec : & mut i64 ) ;
29
- pub unsafe fn rust_mktime ( tm : & Tm , sec : & mut i64 ) ;
28
+ pub unsafe fn rust_timegm ( tm : & Tm ) -> i64 ;
29
+ pub unsafe fn rust_mktime ( tm : & Tm ) -> i64 ;
30
30
}
31
31
}
32
32
@@ -177,12 +177,11 @@ pub impl Tm {
177
177
/// Convert time to the seconds from January 1, 1970
178
178
fn to_timespec ( & self ) -> Timespec {
179
179
unsafe {
180
- let mut sec = 0i64 ;
181
- if self . tm_gmtoff == 0_i32 {
182
- rustrt:: rust_timegm ( self , & mut sec) ;
183
- } else {
184
- rustrt:: rust_mktime ( self , & mut sec) ;
185
- }
180
+ let sec = match self . tm_gmtoff {
181
+ 0_i32 => rustrt:: rust_timegm ( self ) ,
182
+ _ => rustrt:: rust_mktime ( self )
183
+ } ;
184
+
186
185
Timespec :: new ( sec, self . tm_nsec )
187
186
}
188
187
}
0 commit comments