https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89432
Bug ID: 89432
Summary: FAIL:
libphobos.unittests/druntime/{static,shared}/core.time
on CentOS 5.11, Linux 2.6.18
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: d
Assignee: ibuclaw at gdcproject dot org
Reporter: ubizjak at gmail dot com
Target Milestone: ---
libphobos testing on x86_64 CentOS 5.11 fails a testcase:
FAIL: libphobos.unittests/druntime/static/core.time
FAIL: libphobos.unittests/druntime/shared/core.time
with:
Aborting from ../../../../git/gcc/libphobos/libdruntime/core/time.d(2075)
MonoTimeImpl!(ClockType.bootTime) failed to get the frequency of the system's
monotonic clock.
clock_gettime on CentOS 5.11 (Linux 2.6.18) supports only:
clock_gettime returns the current timespec value of tp for the
specific clock, which_clock. The values that clockid_t currently supports for
POSIX.1b timers, as defined in include/linux/time.h, are:
CLOCK_REALTIME
Systemwide realtime clock.
CLOCK_MONOTONIC
Represents monotonic time. Cannot be set.
CLOCK_PROCESS_CPUTIME_ID
High resolution per-process timer.
CLOCK_THREAD_CPUTIME_ID
Thread-specific timer.
CLOCK_REALTIME_HR
High resolution version of CLOCK_REALTIME.
CLOCK_MONOTONIC_HR
High resolution version of CLOCK_MONOTONIC.
There is the following code in time.d:
static bool clockSupported(ClockType c)
{
version (Linux_Pre_2639) // skip CLOCK_BOOTTIME on older linux kernels
return c != ClockType.second && c != ClockType.bootTime;
else
return c != ClockType.second; // second doesn't work with
MonoTimeImpl
but it looks that Linux_Pre_2639 is not handled correctly. Depending on which
kernel is considered the oldest supported kernel, version should also check for
2.6.28, 2.6.32 and 2.6.12:
CLOCK_REALTIME
System-wide clock that measures real (i.e., wall-clock) time.
Setting this clock requires appropriate privileges. This clock is
affected by discontinuous jumps in the system time (e.g., if the system
administrator manually changes the clock), and by the incremental adjustments
performed by adjtime(3) and NTP.
CLOCK_REALTIME_COARSE (since Linux 2.6.32; Linux-specific)
A faster but less precise version of CLOCK_REALTIME. Use when
you need very fast, but not fine-grained timestamps. Requires
per-architecture support, and probably also architecture support for this flag
in the vdso(7).
CLOCK_MONOTONIC
Clock that cannot be set and represents monotonic time since some
unspecified starting point. This clock is not affected by discontinuous jumps
in the system time (e.g., if the system administrator manually changes the
clock), but is affected by the incremental adjustments performed by
adjtime(3) and NTP.
CLOCK_MONOTONIC_COARSE (since Linux 2.6.32; Linux-specific)
A faster but less precise version of CLOCK_MONOTONIC. Use
when you need very fast, but not fine-grained timestamps. Requires
per-architecture support, and probably also architecture support for this flag
in the vdso(7).
CLOCK_MONOTONIC_RAW (since Linux 2.6.28; Linux-specific)
Similar to CLOCK_MONOTONIC, but provides access to a raw
hardware-based time that is not subject to NTP adjustments or the incremental
adjustments performed by adjtime(3).
CLOCK_BOOTTIME (since Linux 2.6.39; Linux-specific)
Identical to CLOCK_MONOTONIC, except it also includes any time
that the system is suspended. This allows applications to get a suspend-aware
monotonic clock without having to deal with the complications of
CLOCK_REALTIME, which may have discontinuities if the time is changed using
settimeofday(2) or similar.
CLOCK_PROCESS_CPUTIME_ID (since Linux 2.6.12)
Per-process CPU-time clock (measures CPU time consumed by all
threads in the process).
CLOCK_THREAD_CPUTIME_ID (since Linux 2.6.12)
Thread-specific CPU-time clock.