forked from Imagelibrary/rtems
added test code for return of remaining time from sleep().
This commit is contained in:
@@ -51,6 +51,7 @@ void *POSIX_Init(
|
|||||||
int status;
|
int status;
|
||||||
pthread_t thread_id;
|
pthread_t thread_id;
|
||||||
time_t seconds;
|
time_t seconds;
|
||||||
|
time_t remaining;
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
struct timespec tv;
|
struct timespec tv;
|
||||||
struct timespec tr;
|
struct timespec tr;
|
||||||
@@ -74,8 +75,8 @@ void *POSIX_Init(
|
|||||||
|
|
||||||
/* use sleep to delay */
|
/* use sleep to delay */
|
||||||
|
|
||||||
seconds = sleep( 3 );
|
remaining = sleep( 3 );
|
||||||
assert( !seconds );
|
assert( !remaining );
|
||||||
|
|
||||||
/* print new times to make sure it has changed and we can get the realtime */
|
/* print new times to make sure it has changed and we can get the realtime */
|
||||||
|
|
||||||
@@ -87,6 +88,11 @@ void *POSIX_Init(
|
|||||||
seconds = time( NULL );
|
seconds = time( NULL );
|
||||||
printf( ctime( &seconds ) );
|
printf( ctime( &seconds ) );
|
||||||
|
|
||||||
|
/* check the time remaining */
|
||||||
|
|
||||||
|
printf( "seconds remaining (%d)\n", (int)remaining );
|
||||||
|
assert( !remaining );
|
||||||
|
|
||||||
/* use nanosleep to delay */
|
/* use nanosleep to delay */
|
||||||
|
|
||||||
tv.tv_sec = 3;
|
tv.tv_sec = 3;
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ void *POSIX_Init(
|
|||||||
int status;
|
int status;
|
||||||
pthread_t thread_id;
|
pthread_t thread_id;
|
||||||
time_t seconds;
|
time_t seconds;
|
||||||
|
time_t remaining;
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
struct timespec tv;
|
struct timespec tv;
|
||||||
struct timespec tr;
|
struct timespec tr;
|
||||||
@@ -74,8 +75,8 @@ void *POSIX_Init(
|
|||||||
|
|
||||||
/* use sleep to delay */
|
/* use sleep to delay */
|
||||||
|
|
||||||
seconds = sleep( 3 );
|
remaining = sleep( 3 );
|
||||||
assert( !seconds );
|
assert( !remaining );
|
||||||
|
|
||||||
/* print new times to make sure it has changed and we can get the realtime */
|
/* print new times to make sure it has changed and we can get the realtime */
|
||||||
|
|
||||||
@@ -87,6 +88,11 @@ void *POSIX_Init(
|
|||||||
seconds = time( NULL );
|
seconds = time( NULL );
|
||||||
printf( ctime( &seconds ) );
|
printf( ctime( &seconds ) );
|
||||||
|
|
||||||
|
/* check the time remaining */
|
||||||
|
|
||||||
|
printf( "seconds remaining (%d)\n", (int)remaining );
|
||||||
|
assert( !remaining );
|
||||||
|
|
||||||
/* use nanosleep to delay */
|
/* use nanosleep to delay */
|
||||||
|
|
||||||
tv.tv_sec = 3;
|
tv.tv_sec = 3;
|
||||||
|
|||||||
Reference in New Issue
Block a user