[PATCH v5] time: Add TIME_MONOTONIC, TIME_ACTIVE, and TIME_THREAD_ACTIVE

Paul Eggert eggert@cs.ucla.edu
Tue Dec 2 18:26:26 GMT 2025


On 2025-12-02 04:24, Adhemerval Zanella wrote:

> +  _Static_assert (TIME_UTC - 1 == CLOCK_REALTIME,
> +		  "TIME_UTC -1 == CLOCK_REALTIME");

Missing space after "-" in the string. There is another instances of this.

Better yet, include <verify.h> and just say "verify (TIME_UTC - 1 == 
CLOCK_REALTIME);". Two-argument _Static_assert is a useless typo magnet.


> +The base @code{TIME_MONOTONIC} returns a monotonic-increasing time since

It's not necessarily increasing. Also adverb-adjective is more common in 
English than adjective-adjective here. So please say "monotonically 
nondecreasing time".


> +an unspecified point in the past.

Add " that may change if the system is rebooted or suspended" (same 
warning as for CLOCK_MONOTONIC).


> -  if (ret == TIME_UTC)
> +  int ret = __timespec_get64 (&tp64, base);
> +  if (ret != 0 && ts != NULL)

Why is the "&& ts != NULL" added?  (There are two instances of this.)

The C standard doesn't require these two additions: although 
timespec_getres has well-defined behavior when TS is null, timespec_get 
does not. Let's stick to the standard rather than adding a bit of bloat 
to support an extension that nobody will (or should) use.



More information about the Libc-alpha mailing list