X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Fliblutil%2Fcsn.c;h=19a74487ff6ae1974cc95da09f44c88bb01db6c5;hb=198879bd5f1baa09e5dc7a951db980a932cd5db5;hp=bab1dd9a8bd1261e7a1ad7f9ccbdfa6fd5421d82;hpb=7ac06970e634c795541bdb1fe9959b6a8701d85d;p=openldap diff --git a/libraries/liblutil/csn.c b/libraries/liblutil/csn.c index bab1dd9a8b..19a74487ff 100644 --- a/libraries/liblutil/csn.c +++ b/libraries/liblutil/csn.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 2000-2007 The OpenLDAP Foundation. + * Copyright 2000-2009 The OpenLDAP Foundation. * Portions Copyright 2000-2003 Kurt D. Zeilenga. * All rights reserved. * @@ -48,33 +48,19 @@ #include +/* Must be mutex-protected, because lutil_gettime needs mutex protection */ size_t lutil_csnstr(char *buf, size_t len, unsigned int replica, unsigned int mod) { struct lutil_tm tm; - static unsigned int csnop; - static int prev_sec, prev_usec; - - unsigned int op; int n; lutil_gettime( &tm ); - 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++; - n = snprintf( buf, len, "%4d%02d%02d%02d%02d%02d.%06dZ#%06x#%03x#%06x", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, - tm.tm_min, tm.tm_sec, tm.tm_usec, op, replica, mod ); + tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_usub, replica, mod ); if( n < 0 ) return 0; return ( (size_t) n < len ) ? n : 0;