Issue #2951 has been updated by zhtw.
I just noticed that in the header sys/time.h there is a whole lot of CLOCK_* constants. Some of them are FreeBSD-specific, some Linux-specific. So technically, but since (at least) CLOCK_PROF is mentioned in the man page, it should work. Btw, I checked CLOCK_THREAD_CPUTIME_ID & CLOCK_PROCESS_CPUTIME_ID (which I actually need) and they don't work either, but it's not mentioned in the man page, so technically not a bug. ---------------------------------------- Bug #2951: clock_gettime always repots 0 sec, 0 nsec http://bugs.dragonflybsd.org/issues/2951#change-12975 * Author: zhtw * Status: New * Priority: Normal * Assignee: * Category: * Target version: ---------------------------------------- When called with CLOCK_PROF, clock_gettime always returns 0 sec, 0 nsec: $ uname -a DragonFly kl.zta.lk 4.6-RELEASE DragonFly v4.6.0.10.g16fba-RELEASE #10: Wed Aug 17 14:26:31 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 $ cat time.c #include <sys/time.h> #include <stdio.h> int main() { struct timespec ts; struct timespec *tp = &ts; for (int i = 0; i != 1000000; ++i) for (int j = 0; j != 1000; ++j) ; int err = clock_gettime(CLOCK_PROF, tp); printf("err: %d\n", err); printf("sec: %ld\n", ts.tv_sec); printf("nsec: %ld\n", ts.tv_nsec); } $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 0 nsec: 0 The same program on a FreeBSD machine seems to work: $ uname -a FreeBSD fbsd 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014 r...@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 1 nsec: 604478000 -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account