]> git.ipfire.org Git - thirdparty/systemd.git/commit
time-util: encode our assumption that clock_gettime() never can return 0 or USEC_INFINITY
authorLennart Poettering <lennart@amutable.com>
Sun, 12 Apr 2026 19:44:59 +0000 (21:44 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 13 Apr 2026 06:52:43 +0000 (08:52 +0200)
commite700d5134df15a094a2c92bc61392fbaf3c0452b
tree6011be1f2bbbf7772e11426bb99b8794d247305f
parentaa85a742fe5e0816312566a700599496e720246d
time-util: encode our assumption that clock_gettime() never can return 0 or USEC_INFINITY

We generally assume that valid times returned by clock_gettime() are > 0
and < USEC_INFINITY. If this wouldn't hold all kinds of things would
break, because we couldn't distuingish our niche values from regular
values anymore.

Let's hence encode our assumptions in C, already to help static
analyzers and LLMs.

Inspired by: https://github.com/systemd/systemd/pull/41601#pullrequestreview-4094645891
src/basic/time-util.c