> -----Original Message----- > From: Steven Woody [mailto:[EMAIL PROTECTED] > Sent: den 27 september 2008 03:40 > To: Peter Kjellerstedt > Subject: Re: CLOCK_MONOTONIC substitution for uclibc? > > On Fri, Sep 26, 2008 at 3:37 PM, Peter Kjellerstedt > <[EMAIL PROTECTED]> wrote: > >> -----Original Message----- > >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On > >> Behalf Of Joakim Tjernlund > >> Sent: den 26 september 2008 09:14 > >> To: Steven Woody > >> Cc: [email protected] > >> Subject: Re: CLOCK_MONOTONIC substitution for uclibc? > >> > >> On Fri, 2008-09-26 at 13:30 +0800, Steven Woody wrote: > >> > Hi, > >> > > >> > I see even though uclibc implemented clock_gettime(clock_id, tp), > it > >> > does not support clock type of CLOCK_MONOTONIC. So if I want some > >> > kind of monotonic time which should not changed by user process ( > >> > such as setting of date), what should I do? > >> > >> Use "ticks = times(NULL)", NULL can only be used on Linux. > >> > >> Jocke > > > > We use CLOCK_MONOTONIC with uClibc without any problem... > > What version of uClibc are you using, and what architecture? > > Here is 0.9.29, are you sure you are using it without problem? Below > is from 0.9.29's code > (uClibc-0.9.29/libc/sysdeps/linux/common/clock_gettime.c): > > int clock_gettime(clockid_t clock_id, struct timespec* tp) > { > struct timeval tv; > int retval = -1; > switch (clock_id) { > case CLOCK_REALTIME: > retval = gettimeofday(&tv, NULL); > if (retval == 0) { > TIMEVAL_TO_TIMESPEC(&tv, tp); > } > break; > default: > errno = EINVAL; > break; > } > return retval; > } > > > What version are you using? Thanks. > > - > narke
You missed the following three lines above that code: #ifdef __NR_clock_gettime _syscall2(int, clock_gettime, clockid_t, clock_id, struct timespec*, tp); #else Thus, the use of CLOCK_MONOTONIC with uClibc relies on clock_gettime() being available as a system call from the kernel (which it obviously is in the 2.6 kernel we use). //Peter _______________________________________________ uClibc mailing list [email protected] http://busybox.net/cgi-bin/mailman/listinfo/uclibc
