From: Howard Chu Date: Fri, 28 Apr 2006 01:26:05 +0000 (+0000) Subject: Fix lutil_parsetime parsing fractional seconds X-Git-Tag: OPENLDAP_REL_ENG_2_4_1ALPHA~2^2~122 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=70de4ee4030e00e5c70c9c1f8b6d876257c6ea5b;p=openldap Fix lutil_parsetime parsing fractional seconds --- diff --git a/libraries/liblutil/utils.c b/libraries/liblutil/utils.c index 0da7df4790..c7ae35cd12 100644 --- a/libraries/liblutil/utils.c +++ b/libraries/liblutil/utils.c @@ -247,14 +247,17 @@ int lutil_parsetime( char *atm, struct lutil_tm *tm ) if (tm->tm_sec < 0 || tm->tm_sec > 61) break; /* Fractions of seconds */ - for (i = 0, fracs = 0; isdigit((unsigned char) *ptr); ) { - i*=10; i+= *ptr++ - '0'; - fracs++; - } - tm->tm_usec = i; - if (i) { - for (i = fracs; i<6; i++) - tm->tm_usec *= 10; + if ( *ptr == '.' ) { + ptr++; + for (i = 0, fracs = 0; isdigit((unsigned char) *ptr); ) { + i*=10; i+= *ptr++ - '0'; + fracs++; + } + tm->tm_usec = i; + if (i) { + for (i = fracs; i<6; i++) + tm->tm_usec *= 10; + } } /* Must be UTC */