This very very likely was fixed a long time ago, but I wanted to be sure.
So I used this simple test program:

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>

void timespec_diff(const struct timespec *start, const struct timespec *stop,
                   struct timespec *result)
{
    if ((stop->tv_nsec - start->tv_nsec) < 0) {
        result->tv_sec = stop->tv_sec - start->tv_sec - 1;
        result->tv_nsec = stop->tv_nsec - start->tv_nsec + 1000000000UL;
    } else {
        result->tv_sec = stop->tv_sec - start->tv_sec;
        result->tv_nsec = stop->tv_nsec - start->tv_nsec;
    }

    return;
}

void timecheck(clockid_t clkid, int argc, char **argv)
{
    struct timespec start, stop, dur;

    if( clock_gettime( clkid, &start) == -1 ) {
      perror( "clock gettime" );
      exit( EXIT_FAILURE );
    }

    system( argv[1] );

    if( clock_gettime( clkid, &stop) == -1 ) {
      perror( "clock gettime" );
      exit( EXIT_FAILURE );
    }

    timespec_diff(&start, &stop, &dur);
    printf( "%4ld.%-12ld\n", dur.tv_sec, dur.tv_nsec);
}

int main( int argc, char **argv )
{
    timecheck(CLOCK_REALTIME, argc, argv);
    timecheck(CLOCK_REALTIME_COARSE, argc, argv);
    timecheck(CLOCK_MONOTONIC, argc, argv);
    timecheck(CLOCK_MONOTONIC_COARSE, argc, argv);
    timecheck(CLOCK_MONOTONIC_RAW, argc, argv);
    timecheck(CLOCK_BOOTTIME, argc, argv);
    timecheck(CLOCK_PROCESS_CPUTIME_ID, argc, argv);
    timecheck(CLOCK_THREAD_CPUTIME_ID, argc, argv);
    return( EXIT_SUCCESS );
}

$ gcc -Wall -o test test.c
$ ./test "sleep 0.3s"

All working on aarch64.

That said we can drop this Delta from libqb.
I have used a libqb synced from Debian in a ppa that doesn't have this fix 
without issues.
That said we can drop this on the next merge/sync of libqb.
Setting the tasks here to Fix released (the issue reported in this bug no more 
exists).

** Changed in: linux (Ubuntu)
       Status: Confirmed => Fix Released

** Changed in: libqb (Ubuntu)
       Status: New => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1239109

Title:
  aarch64 clock_gettime with CLOCK_REALTIME_COARSE or
  CLOCK_MONOTONIC_COARSE fails with SIGBUS or SIGSEGV

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libqb/+bug/1239109/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to