@@ -214,8 +214,8 @@ fn test_posix_gettimeofday() {
214
214
}
215
215
216
216
fn test_localtime_r ( ) {
217
- use std:: env;
218
217
use std:: ffi:: CStr ;
218
+ use std:: { env, ptr} ;
219
219
220
220
// Set timezone to GMT.
221
221
let key = "TZ" ;
@@ -250,22 +250,8 @@ fn test_localtime_r() {
250
250
assert_eq ! ( tm. tm_gmtoff, 0 ) ;
251
251
unsafe { assert_eq ! ( CStr :: from_ptr( tm. tm_zone) . to_str( ) . unwrap( ) , "+00" ) } ;
252
252
253
- let res_tm: libc:: tm ;
254
- unsafe {
255
- res_tm = * res;
256
- }
257
- // The returned value should match the pointer passed in.
258
- assert_eq ! ( res_tm. tm_sec, 56 ) ;
259
- assert_eq ! ( res_tm. tm_min, 43 ) ;
260
- assert_eq ! ( res_tm. tm_hour, 7 ) ;
261
- assert_eq ! ( res_tm. tm_mday, 7 ) ;
262
- assert_eq ! ( res_tm. tm_mon, 3 ) ;
263
- assert_eq ! ( res_tm. tm_year, 124 ) ;
264
- assert_eq ! ( res_tm. tm_wday, 0 ) ;
265
- assert_eq ! ( res_tm. tm_yday, 97 ) ;
266
- assert_eq ! ( res_tm. tm_isdst, -1 ) ;
267
- assert_eq ! ( res_tm. tm_gmtoff, 0 ) ;
268
- unsafe { assert_eq ! ( CStr :: from_ptr( res_tm. tm_zone) . to_str( ) . unwrap( ) , "+00" ) } ;
253
+ // The returned value is the pointer passed in.
254
+ assert ! ( ptr:: eq( res, & mut tm) ) ;
269
255
270
256
//Remove timezone setting.
271
257
env:: remove_var ( key) ;
0 commit comments