From: Theodore Tso Date: Fri, 1 Mar 1991 15:24:50 +0000 (+0000) Subject: If krb5_us_timeofday() now checks the microsecond field for overflow X-Git-Tag: krb5-1.0-alpha4~141 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=631ff15b576508624358e58f537d5310941e1916;p=krb5.git 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 --- 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;