[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: clock_gettime(CLOCK_PROCESS_CPUTIME_ID, ..) returns bogus time



On Tue, Feb 14, 2006 at 11:14:03PM +0100, ladis wrote:
> I just found the same problem as described here:
> http://sources.redhat.com/bugzilla/show_bug.cgi?id=1256
> 
> CLOCK_PROCESS_CPUTIME_ID clock returns wall-clock time since process
> was started instead of CPU-time used by process.

glibc file sysdeps/unix/sysv/linux/kernel-features.h contains following:
/* Beginning with 2.5.63 support for realtime and monotonic clocks and
   timers based on them is available.  */
#if __LINUX_KERNEL_VERSION >= 132415
# define __ASSUME_POSIX_TIMERS		1
#endif

So, debian's glibc is obviously compiled to run with any kernel and in
such case __ASSUME_POSIX_TIMERS is undefined, meaning glibc's own
implementation is used.

I'm not considering it too fortunate, since POSIX defines this clocks as
optional, so I would rather see this call to fail rather than returning
bogus values :-(

Anyway, sorry for the noise.

Best regards,
	ladis



Reply to: