On Wed, Jun 05, 2019 at 08:33:56PM -0400, David Hill wrote:
> Hello -
> 
> I noticed some negative roundtrip times when running traceroute, which uses
> the monotonic clock to calculate the RTT.
> 
> If I run the following code, it eventually bombs.?? It bombs quick if I
> launch Firefox.
> 
> timespeccmp failed
> tp1 s:103780 n:63101042
> tp2 s:103779 n:761117849

please share your dmesg and the output of

        sysctl kern.clockrate kern.timecounter

Could you also share the output when you run the following code?
With and without firefox running?  Curious about how frequently
this happens.

#include <sys/time.h>

#include <err.h>
#include <stdio.h>
#include <time.h>

int
main(void)
{
        struct timespec t0, t1, timeout;

        timeout.tv_sec = 0;
        timeout.tv_nsec = 100000;

        for (;;) {
                clock_gettime(CLOCK_MONOTONIC, &t0);
                if (nanosleep(&timeout, NULL) == -1)
                        err(1, "nanosleep");
                clock_gettime(CLOCK_MONOTONIC, &t1);
                if (timespeccmp(&t0, &t1, >)) {
                        printf("%lld.%09ld precedes %lld.%09ld\n",
                            t1.tv_sec, t1.tv_nsec, t0.tv_sec, t0.tv_nsec);
                }
        }

        return 0;
}

Reply via email to