[Nut-upsdev] (D)state entry timestamping
Jim Klimov
jimklimov+nut at gmail.com
Sat Aug 5 16:40:37 BST 2023
Cheers all,
Just as a heads-up to driver maintainers (and future authors): with the
recent merge
of https://github.com/networkupstools/nut/pull/2010 we now support
timestamps for
the state-tree entries (and a couple of methods to compare them). Precision
depends
on build circumstances (ideally monotonic timespec with nanosecond values,
else
plain timeval which may be confused by NTP, summer/winter times for non-UTC
hosts,
etc.)
Currently the only practical use for this feature was in the same PR to
fix `apcupsd-ups` -
so it no longer wipes known info BEFORE querying the device/server, but can
wipe any
obsolete entries AFTER such query if their timestamps did not get updated.
I suppose such an approach can be extended to many other drivers or even
the whole
framework (e.g. in the `main.c` loop), although some care should be taken
for e.g. "full"
vs. "partial" updates like in `snmp-ups` driver which does not expect
newest data points
for *everything* after *every* loop cycle. Surely, special handling is also
in order for fields
marked as (semi-)static, overrides, immutables, etc.
In any case, such refactoring would be a future and separate endeavour,
although
people are welcome to get on with it and propose PRs :)
Jim Klimov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/nut-upsdev/attachments/20230805/6e9f1f7f/attachment.htm>
More information about the Nut-upsdev
mailing list