File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,6 +72,8 @@ pub mod stdio_tgt_unsafe;
7272pub mod string_tgt_refcount;
7373#[ path = r#"../string/tgt_unsafe.rs"# ]
7474pub mod string_tgt_unsafe;
75+ #[ path = r#"../time/tgt_unsafe.rs"# ]
76+ pub mod time_tgt_unsafe;
7577#[ path = r#"../unique_ptr/tgt_refcount.rs"# ]
7678pub mod unique_ptr_tgt_refcount;
7779#[ path = r#"../unique_ptr/tgt_unsafe.rs"# ]
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ pub unsafe fn test_time_0() {
1111}
1212pub unsafe fn test_gettimeofday_1 ( ) {
1313 let mut tv: timeval = std:: mem:: zeroed :: < timeval > ( ) ;
14+ tv. tv_sec = 0_i64 ;
15+ tv. tv_usec = 0_i64 ;
1416 assert ! (
1517 ( ( ( ( libc:: gettimeofday(
1618 ( & mut tv as * mut timeval) ,
@@ -19,10 +21,17 @@ pub unsafe fn test_gettimeofday_1() {
1921 != 0 )
2022 ) ;
2123 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 ) ) ;
2226}
2327pub unsafe fn test_clock_gettime_2 ( ) {
2428 let mut ts: timespec = std:: mem:: zeroed :: < timespec > ( ) ;
29+ ts. tv_sec = 0_i64 ;
30+ ts. tv_nsec = 0_i64 ;
2531 assert ! ( ( ( ( ( libc:: clock_gettime( 1 , ( & mut ts as * mut timespec) ) ) == ( 0 ) ) as i32 ) != 0 ) ) ;
32+ assert ! ( ( ( ( ( ts. tv_sec) > ( 0_i64 ) ) as i32 ) != 0 ) ) ;
33+ assert ! ( ( ( ( ( ts. tv_nsec) >= ( 0_i64 ) ) as i32 ) != 0 ) ) ;
34+ assert ! ( ( ( ( ( ts. tv_nsec) < ( 1000000000_i64 ) ) as i32 ) != 0 ) ) ;
2635}
2736pub unsafe fn test_localtime_r_3 ( ) {
2837 let mut t: i64 = 0_i64 ;
Original file line number Diff line number Diff line change 77#include <time.h>
88#include <unistd.h>
99
10- static void test_time (void ) {
11- assert (time (NULL ) > 0 );
12- }
10+ static void test_time (void ) { assert (time (NULL ) > 0 ); }
1311
1412static void test_gettimeofday (void ) {
1513 struct timeval tv ;
You can’t perform that action at this time.
0 commit comments