http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47854

           Summary: omp_get_wtime documentation incorrect
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: j...@gcc.gnu.org


The implementation of omp_get_wtime() uses clock_gettime(CLOCK_MONOTONIC, ...)
if available (which IMHO is the correct choice). However, the documentation
(e.g. http://gcc.gnu.org/onlinedocs/libgomp/omp_005fget_005fwtime.html ) states
that "On POSIX compliant systems the seconds since the Epoch (00:00:00 UTC,
January 1, 1970) are returned.". For CLOCK_MONOTONIC, this is incorrect, as
POSIX 2008 only states

http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_gettime.html

"If the Monotonic Clock option is supported, all implementations shall support
a clock_id of CLOCK_MONOTONIC defined in <time.h>. This clock represents the
monotonic clock for the system. For this clock, the value returned by
clock_gettime() represents the amount of time (in seconds and nanoseconds)
since an unspecified point in the past (for example, system start-up time, or
the Epoch). This point does not change after system start-up time. "

And indeed, at least on Linux 2.6.32, that starting point is not the epoch.

Reply via email to