Commit f3febd73 authored by David S. Miller's avatar David S. Miller

[POSIX_TIMERS]: Do not assume timeval/timespec layout is identical.

Based upon a patch from Jakub Jelinek <jakub@redhat.com>
parent a927d4c7
...@@ -948,11 +948,15 @@ void exit_itimers(struct task_struct *tsk) ...@@ -948,11 +948,15 @@ void exit_itimers(struct task_struct *tsk)
*/ */
static int do_posix_gettime(struct k_clock *clock, struct timespec *tp) static int do_posix_gettime(struct k_clock *clock, struct timespec *tp)
{ {
struct timeval tv;
if (clock->clock_get) if (clock->clock_get)
return clock->clock_get(tp); return clock->clock_get(tp);
do_gettimeofday((struct timeval *) tp); do_gettimeofday(&tv);
tp->tv_nsec *= NSEC_PER_USEC; tp->tv_sec = tv.tv_sec;
tp->tv_nsec = tv.tv_usec * NSEC_PER_USEC;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment