@@ -9,20 +9,31 @@ use std::rc::Rc;
99pub unsafe fn test_time_0 ( ) {
1010 assert ! ( ( ( ( ( libc:: time( std:: ptr:: null_mut( ) ) ) > ( 0_i64 ) ) as i32 ) != 0 ) ) ;
1111}
12- pub unsafe fn test_clock_gettime_1 ( ) {
13- let mut ts : timespec = std:: mem:: zeroed :: < timespec > ( ) ;
14- ts . tv_sec = 0_i64 ;
15- ts . tv_nsec = 0_i64 ;
12+ pub unsafe fn test_gettimeofday_1 ( ) {
13+ let mut tv : timeval = std:: mem:: zeroed :: < timeval > ( ) ;
14+ tv . tv_sec = 0_i64 ;
15+ tv . tv_usec = 0_i64 ;
1616 assert ! (
17- ( ( ( ( libc:: clock_gettime( 1 as :: libc:: clockid_t, ( & mut ts as * mut timespec) ) ) == ( 0 ) )
18- as i32 )
17+ ( ( ( ( libc:: gettimeofday(
18+ ( & mut tv as * mut timeval) ,
19+ ( 0 as * mut :: libc:: c_void) as * mut :: libc:: timezone
20+ ) ) == ( 0 ) ) as i32 )
1921 != 0 )
2022 ) ;
23+ assert ! ( ( ( ( ( tv. tv_sec) > ( 0_i64 ) ) as i32 ) != 0 ) ) ;
24+ assert ! ( ( ( ( ( tv. tv_usec) >= ( 0_i64 ) ) as i32 ) != 0 ) ) ;
25+ assert ! ( ( ( ( ( tv. tv_usec) < ( 1000000_i64 ) ) as i32 ) != 0 ) ) ;
26+ }
27+ pub unsafe fn test_clock_gettime_2 ( ) {
28+ let mut ts: timespec = std:: mem:: zeroed :: < timespec > ( ) ;
29+ ts. tv_sec = 0_i64 ;
30+ ts. tv_nsec = 0_i64 ;
31+ assert ! ( ( ( ( ( libc:: clock_gettime( 1 , ( & mut ts as * mut timespec) ) ) == ( 0 ) ) as i32 ) != 0 ) ) ;
2132 assert ! ( ( ( ( ( ts. tv_sec) > ( 0_i64 ) ) as i32 ) != 0 ) ) ;
2233 assert ! ( ( ( ( ( ts. tv_nsec) >= ( 0_i64 ) ) as i32 ) != 0 ) ) ;
2334 assert ! ( ( ( ( ( ts. tv_nsec) < ( 1000000000_i64 ) ) as i32 ) != 0 ) ) ;
2435}
25- pub unsafe fn test_localtime_r_2 ( ) {
36+ pub unsafe fn test_localtime_r_3 ( ) {
2637 let mut t: i64 = 0_i64 ;
2738 let mut tm: tm = std:: mem:: zeroed :: < tm > ( ) ;
2839 assert ! (
@@ -32,7 +43,7 @@ pub unsafe fn test_localtime_r_2() {
3243 ) ;
3344 assert ! ( ( ( ( ( tm. tm_year) == ( 70 ) ) as i32 ) != 0 ) ) ;
3445}
35- pub unsafe fn test_gmtime_r_3 ( ) {
46+ pub unsafe fn test_gmtime_r_4 ( ) {
3647 let mut t: i64 = 0_i64 ;
3748 let mut tm: tm = std:: mem:: zeroed :: < tm > ( ) ;
3849 assert ! (
@@ -45,7 +56,7 @@ pub unsafe fn test_gmtime_r_3() {
4556 assert ! ( ( ( ( ( tm. tm_mday) == ( 1 ) ) as i32 ) != 0 ) ) ;
4657 assert ! ( ( ( ( ( tm. tm_hour) == ( 0 ) ) as i32 ) != 0 ) ) ;
4758}
48- pub unsafe fn test_strftime_4 ( ) {
59+ pub unsafe fn test_strftime_5 ( ) {
4960 let mut t: i64 = 0_i64 ;
5061 let mut tm: tm = std:: mem:: zeroed :: < tm > ( ) ;
5162 libc:: gmtime_r ( ( & mut t as * mut i64 ) . cast_const ( ) , ( & mut tm as * mut tm ) ) ;
@@ -68,7 +79,7 @@ pub unsafe fn test_strftime_4() {
6879 != 0 )
6980 ) ;
7081}
71- pub unsafe fn test_utimes_5 ( ) {
82+ pub unsafe fn test_utimes_6 ( ) {
7283 let mut path: * const u8 = ( b"/tmp/cpp2rust_utimes_test.tmp\0 " . as_ptr ( ) . cast_mut ( ) ) . cast_const ( ) ;
7384 let mut fp: * mut :: std:: fs:: File =
7485 match std:: ffi:: CStr :: from_ptr ( ( b"wb\0 " . as_ptr ( ) . cast_mut ( ) ) . cast_const ( ) as * const i8 )
@@ -126,10 +137,11 @@ pub fn main() {
126137}
127138unsafe fn main_0 ( ) -> i32 {
128139 ( unsafe { test_time_0 ( ) } ) ;
129- ( unsafe { test_clock_gettime_1 ( ) } ) ;
130- ( unsafe { test_localtime_r_2 ( ) } ) ;
131- ( unsafe { test_gmtime_r_3 ( ) } ) ;
132- ( unsafe { test_strftime_4 ( ) } ) ;
133- ( unsafe { test_utimes_5 ( ) } ) ;
140+ ( unsafe { test_gettimeofday_1 ( ) } ) ;
141+ ( unsafe { test_clock_gettime_2 ( ) } ) ;
142+ ( unsafe { test_localtime_r_3 ( ) } ) ;
143+ ( unsafe { test_gmtime_r_4 ( ) } ) ;
144+ ( unsafe { test_strftime_5 ( ) } ) ;
145+ ( unsafe { test_utimes_6 ( ) } ) ;
134146 return 0 ;
135147}
0 commit comments