[nut-Bugs][313634] Use difftime for time comparison

nut-bugs at alioth.debian.org nut-bugs at alioth.debian.org
Wed Sep 26 08:01:53 UTC 2012


nut-Bugs item #313634, was changed at 2012-09-26 10:01 by Vaclav Krpec
You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=411542&aid=313634&group_id=30602

Status: Open
Priority: 3
Submitted By: Arnaud Quette (aquette)
Assigned to: Vaclav Krpec (vencik-guest)
Summary: Use difftime for time comparison 
Category: None
Group: None
Resolution: None


Initial Comment:
prefer to use difftime() for time comparison.

Missing implementations:
- mge-utalk
- snmp-ups
- usbhid-ups
- maybe some others...

----------------------------------------------------------------------

>Comment By: Vaclav Krpec (vencik-guest)
Date: 2012-09-26 10:01

Message:
On second thoughts, that shouldn't be real problem; however, at least it will be unified...

----------------------------------------------------------------------

Comment By: Vaclav Krpec (vencik-guest)
Date: 2012-09-26 08:58

Message:
I've found at least 2 occurrences of the following practice as well (generalised & compacted):
nextpoll = now + interval;
/* ... */
if (difftime(nextpoll, now) < 0.0) /* or if (nextpoll < now) etc */

This is the same problem (for non numeric implementations of time_t).
I'm fixing it, too.


----------------------------------------------------------------------

Comment By: Charles Lepple (clepple-guest)
Date: 2012-09-24 14:41

Message:
See also the patches for this bug, which tries to replace some instances of difftime() with a version that considers clock rollback:

https://alioth.debian.org/tracker/index.php?func=detail&aid=313714&group_id=30602&atid=411544

https://github.com/baruch/nut/commits/master/

----------------------------------------------------------------------

You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=411542&aid=313634&group_id=30602



More information about the NUT-tracker mailing list