From 7ac06970e634c795541bdb1fe9959b6a8701d85d Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 6 Feb 2007 04:48:35 +0000 Subject: [PATCH] Don't let timestamps go backward --- libraries/liblutil/csn.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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++; -- 2.39.5