summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1991-03-01 15:24:50 +0000
committerTheodore Tso <tytso@mit.edu>1991-03-01 15:24:50 +0000
commit631ff15b576508624358e58f537d5310941e1916 (patch)
tree77ed8cd451577695607c63c285f7954feb0575ae /src/lib
parent78e619e25a391a1bb226e3050bd198a832d598ec (diff)
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
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/krb5/os/ustime.c10
1 files 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;