From: Howard Chu Date: Tue, 6 Feb 2007 04:48:35 +0000 (+0000) Subject: Don't let timestamps go backward X-Git-Tag: OPENLDAP_REL_ENG_2_4_4ALPHA~8^2~61 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7ac06970e634c795541bdb1fe9959b6a8701d85d;p=openldap Don't let timestamps go backward --- diff --git a/libraries/liblutil/csn.c b/libraries/liblutil/csn.c index 647eabe4ec..bab1dd9a8b 100644 --- a/libraries/liblutil/csn.c +++ b/libraries/liblutil/csn.c @@ -60,10 +60,14 @@ lutil_csnstr(char *buf, size_t len, unsigned int replica, unsigned int mod) lutil_gettime( &tm ); - if ( tm.tm_usec != prev_usec || tm.tm_sec != prev_sec ) { + if ( tm.tm_sec > prev_sec || ( tm.tm_sec == prev_sec && + tm.tm_usec > prev_usec )) { prev_sec = tm.tm_sec; prev_usec = tm.tm_usec; csnop = 0; + } else { + tm.tm_sec = prev_sec; + tm.tm_usec = prev_usec; } op = csnop++;