HomeClusterLabs Projects

Refactor: libcrmcommon: Clarify fractional seconds in time format

Description

Refactor: libcrmcommon: Clarify fractional seconds in time format

The use of "%N" and "nano_*" were misleading. We only support storing
and displaying times at microsecond resolution or less.

  • Storing: Note that we fetch hr_dt->useconds and append three zeros unconditionally in the string representation (as nanoseconds).
  • Displaying: Note the nano_digits = QB_MIN(nano_digits, 6). This caps the displayed field width so that the fractional (decimal) component of a timestamp is at microsecond resolution or coarser. So we can never display any of the three zeros that were appended above.

We have to keep "%N" and the existing behavior for backward
compatibility, of course.

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

Details

Provenance
nrwahl2Authored on Thu, Jun 19, 3:55 AM
Parents
rP0fcc669cd3b7: Refactor: libcrmcommon: Avoid snprintf() in pcmk__time_format_hr()
Branches
Unknown
Tags
Unknown