From 3ea58a8163cd087eeeac033b76fee861cb415236 Mon Sep 17 00:00:00 2001
From: Kurt Zeilenga <kurt@openldap.org>
Date: Tue, 9 May 2006 19:48:32 +0000
Subject: [PATCH] lutil time resolution issue

---
 CHANGES                    |  1 +
 libraries/liblutil/utils.c | 19 +++++++++++--------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/CHANGES b/CHANGES
index b3c3c055e2..1f2a7e8874 100644
--- a/CHANGES
+++ b/CHANGES
@@ -20,6 +20,7 @@ OpenLDAP 2.3.22 Engineering
 	Fixed slapo-translucent modifications
 	Fixed libldap_r thread debug missing break
 	Fixed libldap_r tpool cleanup
+	Fixed liblutil time resolution issue
 
 OpenLDAP 2.3.21 Release
 	Fixed libldap referral chasing issue (ITS#4448)
diff --git a/libraries/liblutil/utils.c b/libraries/liblutil/utils.c
index 31849fea04..ce5304f3f1 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 */
-- 
GitLab