From 631ff15b576508624358e58f537d5310941e1916 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Fri, 1 Mar 1991 15:24:50 +0000 Subject: [PATCH] If krb5_us_timeofday() now checks the microsecond field for overflow into the seconds field when it is bumping the value last returned by gettimeofday. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1831 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/os/ustime.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/krb5/os/ustime.c b/src/lib/krb5/os/ustime.c index 65146492f..46117343a 100644 --- a/src/lib/krb5/os/ustime.c +++ b/src/lib/krb5/os/ustime.c @@ -36,9 +36,13 @@ register krb5_int32 *seconds, *microseconds; /* failed, return errno */ return (krb5_error_code) errno; } - if ((tv.tv_sec == last_tv.tv_sec) && (tv.tv_usec == last_tv.tv_usec)) - tv.tv_usec = ++last_tv.tv_usec; - else + if ((tv.tv_sec == last_tv.tv_sec) && (tv.tv_usec == last_tv.tv_usec)) { + if (++last_tv.tv_usec >= 1000000) { + last_tv.tv_usec = 0; + last_tv.tv_sec++; + } + tv = last_tv; + } else last_tv = tv; *seconds = tv.tv_sec; -- 2.26.2