HomeClusterLabs Projects

Refactor: libcrmcommon: New pcmk__timespec2str() function

Description

Refactor: libcrmcommon: New pcmk__timespec2str() function

This is like pcmk__epoch2str() but accepts a struct timespec value.

The original plan was to simply extend pcmk__epoch2str() to accept usecs
or nsecs. However, all attempts resulted in a confusing interface. (For
example, how do we handle nonzero usecs intuitively if the epoch pointer
is NULL? If we make the usecs argument a pointer like the epoch argument,
how do we handle various combinations of NULL, zero, and nonzero values?)

A separate function accepting a timespec feels cleaner even if a bit
redundant.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>

Details

Provenance
nrwahl2Authored on Nov 11 2022, 9:39 PM
Parents
rPf8ac50e17c49: Refactor: libcrmcommon: New time_as_string_common(), supports usec
Branches
Unknown
Tags
Unknown