diff options
| author | Daniel Eischen <deischen@FreeBSD.org> | 2000-12-20 17:04:12 +0000 |
|---|---|---|
| committer | Daniel Eischen <deischen@FreeBSD.org> | 2000-12-20 17:04:12 +0000 |
| commit | 9ffc4537c8f682f953ddb8e404da99363884db4e (patch) | |
| tree | d17197fdff15337d7034a3b1c08e70dabf5974ae /lib/libpthread/thread | |
| parent | b37c9b907b8072a460796108337ebce927ad3d60 (diff) | |
Notes
Diffstat (limited to 'lib/libpthread/thread')
| -rw-r--r-- | lib/libpthread/thread/thr_nanosleep.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/libpthread/thread/thr_nanosleep.c b/lib/libpthread/thread/thr_nanosleep.c index 3bbc9a64fce6..67dd08dbff2a 100644 --- a/lib/libpthread/thread/thr_nanosleep.c +++ b/lib/libpthread/thread/thr_nanosleep.c @@ -54,8 +54,12 @@ _nanosleep(const struct timespec * time_to_sleep, errno = EINVAL; ret = -1; } else { - /* Get the current time: */ - gettimeofday(&tv, NULL); + /* + * As long as we're going to get the time of day, we + * might as well store it in the global time of day: + */ + gettimeofday((struct timeval *) &_sched_tod, NULL); + GET_CURRENT_TOD(tv); TIMEVAL_TO_TIMESPEC(&tv, ¤t_time); /* Calculate the time for the current thread to wake up: */ @@ -73,8 +77,12 @@ _nanosleep(const struct timespec * time_to_sleep, /* Reschedule the current thread to sleep: */ _thread_kern_sched_state(PS_SLEEP_WAIT, __FILE__, __LINE__); - /* Get the current time: */ - gettimeofday(&tv, NULL); + /* + * As long as we're going to get the time of day, we + * might as well store it in the global time of day: + */ + gettimeofday((struct timeval *) &_sched_tod, NULL); + GET_CURRENT_TOD(tv); TIMEVAL_TO_TIMESPEC(&tv, ¤t_time1); /* Calculate the remaining time to sleep: */ |
