diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-06-01 11:21:15 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-06-01 10:38:47 +0200 |
commit | 56e72337b01216dc7cba418f040a5cc928e5fc6f (patch) | |
tree | 7d64feee26bfeede2ab07ea6045ac11ebb4ea3c2 /lib/util/time.h | |
parent | 9bd695c83f43cacfc08566f3c18db44b61f7ed75 (diff) | |
download | samba-56e72337b01216dc7cba418f040a5cc928e5fc6f.tar.gz |
lib/util/time.c: timeval_current_ofs_msec
Several places want "milliseconds from current time", and several were
simply doing "msec * 1000" which can (and does in one place) result in
a usec value over 1 a million.
Using a helper to do this is safer and more readable.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/util/time.h')
-rw-r--r-- | lib/util/time.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/util/time.h b/lib/util/time.h index 3a406340f45..4e4f72f71fb 100644 --- a/lib/util/time.h +++ b/lib/util/time.h @@ -213,6 +213,11 @@ struct timeval timeval_sum(const struct timeval *tv1, _PUBLIC_ struct timeval timeval_current_ofs(uint32_t secs, uint32_t usecs); /** + return a timeval milliseconds into the future +*/ +_PUBLIC_ struct timeval timeval_current_ofs_msec(uint32_t msecs); + +/** compare two timeval structures. Return -1 if tv1 < tv2 Return 0 if tv1 == tv2 |