From 91ea416bc25d6b143871241bb023f100ae40e1a5 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Fri, 12 Apr 1996 02:18:11 +0000 Subject: [PATCH] When doing the time offset adjustments, make sure the microseconds field doesn't go negative. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7800 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/os/ChangeLog | 6 ++++++ src/lib/krb5/os/ustime.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index c754ca46a..c6edc6d64 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,9 @@ +Thu Apr 11 22:15:44 1996 Theodore Y. Ts'o + + * ustime.c (krb5_us_timeofday): When doing the time offset + adjustments, make sure the microseconds field doesn't go + negative. + Thu Mar 28 17:20:12 1996 Theodore Y. Ts'o * DNR.c: Replace eight-year-old version of this file with the diff --git a/src/lib/krb5/os/ustime.c b/src/lib/krb5/os/ustime.c index 9fd9dd726..ee7535324 100644 --- a/src/lib/krb5/os/ustime.c +++ b/src/lib/krb5/os/ustime.c @@ -53,6 +53,10 @@ krb5_us_timeofday(context, seconds, microseconds) usec -= 1000000; sec++; } + if (usec < 0) { + usec += 1000000; + sec--; + } sec += os_ctx->time_offset; } *seconds = sec; -- 2.26.2