summaryrefslogtreecommitdiff
path: root/source3/lib/time.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-09-14 14:53:17 -0700
committerJeremy Allison <jra@samba.org>2010-09-14 14:53:17 -0700
commit0b270f014f67b8ff49b70fb41b2cceac121f337e (patch)
treec9641065c49bd40a017f58020aacf8e28fb0d6e6 /source3/lib/time.c
parent55b315094ef8a8ed691f9717c28cab301e17ef25 (diff)
downloadsamba-0b270f014f67b8ff49b70fb41b2cceac121f337e.tar.gz
samba-0b270f014f67b8ff49b70fb41b2cceac121f337e.tar.bz2
samba-0b270f014f67b8ff49b70fb41b2cceac121f337e.zip
Ensure incoming timespec values correctly wrap at nsecs.
Jeremy.
Diffstat (limited to 'source3/lib/time.c')
-rw-r--r--source3/lib/time.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source3/lib/time.c b/source3/lib/time.c
index fad5d97cb1..eba358f11f 100644
--- a/source3/lib/time.c
+++ b/source3/lib/time.c
@@ -409,6 +409,10 @@ void round_timespec_to_usec(struct timespec *ts)
{
struct timeval tv = convert_timespec_to_timeval(*ts);
*ts = convert_timeval_to_timespec(tv);
+ while (ts->tv_nsec > 1000000000) {
+ ts->tv_sec += 1;
+ ts->tv_nsec -= 1000000000;
+ }
}
/****************************************************************************