[Swan-dev] new delta time type

D. Hugh Redelmeier hugh at mimosa.com
Mon Feb 2 04:50:51 EET 2015


| From: Antony Antony <antony at phenome.org>
| 
| The reason I didn't use timeval immediately in #libevent was due to lack 
| of arithmetic and configuration option parsing functions. Otherwise 
| timeval seems an obvious choice except when defining constants.
| 
| If we create a type it could be called delta_tv. I guess the 
| configuration parser should understand this and store the value in 
| delta_tv. arithmetic functions and parsing functions looks like a major 
| surgery:)
| 
| If we use timeval, can we use something like 
| http://www.geonius.com/software/libgpl/tv_util.html ;  If the license 
| compatible with libreswan?

Have a look at timeradd(3).  Several struct timeval functions seem to
be in glibc and Fedora.  They are inherited from BSD, not POSIX.  For
that reason I'm not sure if we should be using them.

If they look good but we don't want to use BSD functions, it would not
be hard to re-implement them with non-clashing names.  And more const
parameters :-).

But really, it isn't a lot of work to implement "operators" for struct
timeval.  As we've seen, it takes care with the details and edge
conditions to avoid bugs.


More information about the Swan-dev mailing list