[Bug 262273] Subsuquent Calls to clock_gettime(CLOCK_THREAD_CPUTIME_ID,... ) return time in the past

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 01 Mar 2022 14:45:08 UTC

--- Comment #4 from firk@cantconnect.ru ---
I can't reproduce this (but that's not on Ryzen)

Try this

#include <stdio.h>
#include <sys/time.h>

int main(void)
        struct timespec before, after;

        clockid_t cid;
        if(clock_getcpuclockid2(0, CPUCLOCK_WHICH_TID, &cid)<0) return -1;

        while (1) {
                clock_gettime(cid, &before);
                clock_gettime(cid, &after);

                printf("before: %lu:%lu after %lu:%lu\n",
                        before.tv_sec, before.tv_nsec,
                        after.tv_sec, after.tv_nsec);

                if (after.tv_nsec < before.tv_nsec)
                        return -1;

same problem?

You are receiving this mail because:
You are the assignee for the bug.