From 68a473e6af085065d0e906d24b2e01ccc1b12e35 Mon Sep 17 00:00:00 2001
From: Kurt Zeilenga <kurt@openldap.org>
Date: Wed, 21 Oct 1998 19:26:49 +0000
Subject: [PATCH] Use gmtime() instead of localtime()

---
 servers/slapd/add.c     | 3 ++-
 servers/slapd/modify.c  | 3 ++-
 servers/slapd/monitor.c | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/servers/slapd/add.c b/servers/slapd/add.c
index 93cc3cdcd3..ec233cd6a5 100644
--- a/servers/slapd/add.c
+++ b/servers/slapd/add.c
@@ -184,10 +184,11 @@ add_created_attrs( Operation *op, Entry *e )
 	attr_merge( e, "creatorsname", bvals );
 
 	pthread_mutex_lock( &currenttime_mutex );
-	ltm = localtime( &currenttime );
 #ifdef LDAP_Y2K
+	ltm = gmtime( &currenttime );
 	strftime( buf, sizeof(buf), "%Y%m%d%H%M%SZ", ltm );
 #else
+	ltm = localtime( &currenttime );
 	strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm );
 #endif
 	pthread_mutex_unlock( &currenttime_mutex );
diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c
index dd7689cfaf..ff6d4dd047 100644
--- a/servers/slapd/modify.c
+++ b/servers/slapd/modify.c
@@ -251,10 +251,11 @@ add_lastmods( Operation *op, LDAPMod **mods )
 	*mods = tmp;
 
 	pthread_mutex_lock( &currenttime_mutex );
-	ltm = localtime( &currenttime );
 #ifdef LDAP_Y2K
+	ltm = gmtime( &currenttime );
 	strftime( buf, sizeof(buf), "%Y%m%d%H%M%SZ", ltm );
 #else
+	ltm = localtime( &currenttime );
 	strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm );
 #endif
 	pthread_mutex_unlock( &currenttime_mutex );
diff --git a/servers/slapd/monitor.c b/servers/slapd/monitor.c
index a7311989ef..6a3403ea92 100644
--- a/servers/slapd/monitor.c
+++ b/servers/slapd/monitor.c
@@ -93,10 +93,11 @@ monitor_info( Connection *conn, Operation *op )
 				nreadwaiters++;
 			}
 			pthread_mutex_lock( &currenttime_mutex );
-			ltm = localtime( &c[i].c_starttime );
 #ifdef LDAP_Y2K
+			ltm = gmtime( &c[i].c_starttime );
 			strftime( buf2, sizeof(buf2), "%Y%m%d%H%M%SZ", ltm );
 #else
+			ltm = localtime( &c[i].c_starttime );
 			strftime( buf2, sizeof(buf2), "%y%m%d%H%M%SZ", ltm );
 #endif
 			pthread_mutex_unlock( &currenttime_mutex );
-- 
GitLab