mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-03-07 14:18:15 +08:00
Fix lutil_parsetime parsing fractional seconds
This commit is contained in:
parent
3879cac787
commit
70de4ee403
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user