From b51e1cc560180a8484c3dba447bff2cc1f1aeda4 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Sat, 23 Feb 2008 22:35:09 +0000
Subject: [PATCH] Eliminated the "LOCAL_TZ/TIMEZONE" system toggle option and
 server/service startup option - we will *always* use the local timezone. If
 the sysop wants to use GMT/UTC, they should configure their operating system
 accordingly.

---
 src/sbbs3/addfiles.c |  5 +----
 src/sbbs3/delfiles.c |  5 +----
 src/sbbs3/filelist.c |  5 +----
 src/sbbs3/ftpsrvr.c  | 22 ++--------------------
 src/sbbs3/ftpsrvr.h  |  4 +---
 src/sbbs3/jsexec.c   |  3 ---
 src/sbbs3/mailsrvr.c | 22 ++--------------------
 src/sbbs3/mailsrvr.h |  4 +---
 src/sbbs3/main.cpp   | 22 ++--------------------
 src/sbbs3/makeuser.c |  3 ---
 src/sbbs3/sbbscon.c  | 16 +---------------
 src/sbbs3/sbbsdefs.h |  2 +-
 src/sbbs3/services.c | 22 ++--------------------
 src/sbbs3/services.h |  2 +-
 src/sbbs3/startup.h  |  4 +---
 src/sbbs3/websrvr.c  |  6 ------
 src/sbbs3/websrvr.h  |  3 +--
 17 files changed, 18 insertions(+), 132 deletions(-)

diff --git a/src/sbbs3/addfiles.c b/src/sbbs3/addfiles.c
index 48732cd7dd..9a02b5f313 100644
--- a/src/sbbs3/addfiles.c
+++ b/src/sbbs3/addfiles.c
@@ -8,7 +8,7 @@
  * @format.tab-size 4		(Plain Text/Source Code File Header)			*
  * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
  *																			*
- * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html		*
+ * Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html		*
  *																			*
  * This program is free software; you can redistribute it and/or			*
  * modify it under the terms of the GNU General Public License				*
@@ -711,9 +711,6 @@ int main(int argc, char **argv)
 	SAFECOPY(scfg.temp_dir,"../temp");
 	prep_dir(scfg.ctrl_dir, scfg.temp_dir, sizeof(scfg.temp_dir));
 
-	if(!(scfg.sys_misc&SM_LOCAL_TZ))
-		putenv("TZ=UTC0");
-
 	if(argv[1][0]=='*' || argv[1][0]=='-') {
 		if(argv[1][1]=='?') {
 			printf(usage);
diff --git a/src/sbbs3/delfiles.c b/src/sbbs3/delfiles.c
index 3362bb1bfc..8719132b68 100644
--- a/src/sbbs3/delfiles.c
+++ b/src/sbbs3/delfiles.c
@@ -8,7 +8,7 @@
  * @format.tab-size 4		(Plain Text/Source Code File Header)			*
  * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
  *																			*
- * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html		*
+ * Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html		*
  *																			*
  * This program is free software; you can redistribute it and/or			*
  * modify it under the terms of the GNU General Public License				*
@@ -133,9 +133,6 @@ int main(int argc, char **argv)
 	load_cfg(&cfg, NULL, TRUE, str);
 	chdir(cfg.ctrl_dir);
 
-	if(!(cfg.sys_misc&SM_LOCAL_TZ))
-		putenv("TZ=UTC0");
-
 	dirnum=libnum=-1;
 	if(argv[1][0]=='*')
 		misc|=ALL;
diff --git a/src/sbbs3/filelist.c b/src/sbbs3/filelist.c
index 9e589ce177..9bb7d77364 100644
--- a/src/sbbs3/filelist.c
+++ b/src/sbbs3/filelist.c
@@ -10,7 +10,7 @@
  * @format.tab-size 4		(Plain Text/Source Code File Header)			*
  * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
  *																			*
- * Copyright 2007 Rob Swindell - http://www.synchro.net/copyright.html		*
+ * Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html		*
  *																			*
  * This program is free software; you can redistribute it and/or			*
  * modify it under the terms of the GNU General Public License				*
@@ -175,9 +175,6 @@ int main(int argc, char **argv)
 	SAFECOPY(scfg.temp_dir,"../temp");
 	prep_dir(scfg.ctrl_dir, scfg.temp_dir, sizeof(scfg.temp_dir));
 
-	if(!(scfg.sys_misc&SM_LOCAL_TZ))
-		putenv("TZ=UTC0");
-
 	dirnum=libnum=-1;
 	if(argv[1][0]=='*')
 		misc|=ALL;
diff --git a/src/sbbs3/ftpsrvr.c b/src/sbbs3/ftpsrvr.c
index 383f2d9cdc..dbe9af40c1 100644
--- a/src/sbbs3/ftpsrvr.c
+++ b/src/sbbs3/ftpsrvr.c
@@ -997,16 +997,6 @@ BOOL js_generate_index(JSContext* js_cx, JSObject* parent,
 
 #endif	/* ifdef JAVASCRIPT */
 
-static time_t checktime(void)
-{
-	struct tm tm;
-
-    memset(&tm,0,sizeof(tm));
-    tm.tm_year=94;
-    tm.tm_mday=1;
-    return(mktime(&tm)-0x2D24BD00L);
-}
-
 BOOL upload_stats(ulong bytes)
 {
 	char	str[MAX_PATH+1];
@@ -4680,16 +4670,8 @@ void DLLCALL ftp_server(void* arg)
 		if(startup->host_name[0]==0)
 			SAFECOPY(startup->host_name,scfg.sys_inetaddr);
 
-		if(!(scfg.sys_misc&SM_LOCAL_TZ) && !(startup->options&FTP_OPT_LOCAL_TIMEZONE)) { 
-			if(putenv("TZ=UTC0"))
-				lprintf(LOG_ERR,"!putenv() FAILED");
-			tzset();
-
-			if((t=checktime())!=0) {   /* Check binary time */
-				lprintf(LOG_ERR,"!TIME PROBLEM (%ld)",t);
-				cleanup(1,__LINE__);
-				return;
-			}
+		if((t=checktime())!=0) {   /* Check binary time */
+			lprintf(LOG_ERR,"!TIME PROBLEM (%ld)",t);
 		}
 
 		if(uptime==0)
diff --git a/src/sbbs3/ftpsrvr.h b/src/sbbs3/ftpsrvr.h
index 066ebac52f..dcfff76cb4 100644
--- a/src/sbbs3/ftpsrvr.h
+++ b/src/sbbs3/ftpsrvr.h
@@ -116,11 +116,10 @@ static struct init_field ftp_init_fields[] = {
 #define FTP_OPT_NO_HOST_LOOKUP		(1<<11)
 #define FTP_OPT_NO_RECYCLE			(1<<27)	/* Disable recycling of server		*/
 #define FTP_OPT_NO_JAVASCRIPT		(1<<29)	/* JavaScript disabled				*/
-#define FTP_OPT_LOCAL_TIMEZONE		(1<<30)	/* Don't force UTC/GMT */
 #define FTP_OPT_MUTE				(1<<31)
 
 /* ftp_startup_t.options bits that require re-init/recycle when changed */
-#define FTP_INIT_OPTS	(FTP_OPT_LOCAL_TIMEZONE)
+#define FTP_INIT_OPTS	(0)
 
 #if defined(STARTUP_INI_BITDESC_TABLES)
 static ini_bitdesc_t ftp_options[] = {
@@ -138,7 +137,6 @@ static ini_bitdesc_t ftp_options[] = {
 	{ FTP_OPT_NO_HOST_LOOKUP		,"NO_HOST_LOOKUP"		},
 	{ FTP_OPT_NO_RECYCLE			,"NO_RECYCLE"			},
 	{ FTP_OPT_NO_JAVASCRIPT			,"NO_JAVASCRIPT"		},
-	{ FTP_OPT_LOCAL_TIMEZONE		,"LOCAL_TIMEZONE"		},
 	{ FTP_OPT_MUTE					,"MUTE"					},
 	/* terminator */										
 	{ 0 							,NULL					}
diff --git a/src/sbbs3/jsexec.c b/src/sbbs3/jsexec.c
index 87f23451fa..ce40e47d5c 100644
--- a/src/sbbs3/jsexec.c
+++ b/src/sbbs3/jsexec.c
@@ -959,9 +959,6 @@ int main(int argc, char **argv, char** environ)
 	if(host_name==NULL)
 		host_name=scfg.sys_inetaddr;
 
-	if(!(scfg.sys_misc&SM_LOCAL_TZ))
-		putenv("TZ=UTC0");
-
 #if defined(__unix__)
 	if(daemonize) {
 		fprintf(statfp,"\nRunning as daemon\n");
diff --git a/src/sbbs3/mailsrvr.c b/src/sbbs3/mailsrvr.c
index 73a54be9e8..1e0879464d 100644
--- a/src/sbbs3/mailsrvr.c
+++ b/src/sbbs3/mailsrvr.c
@@ -302,16 +302,6 @@ int sockprintf(SOCKET sock, char *fmt, ...)
 	return(len);
 }
 
-static time_t checktime(void)
-{
-	struct tm tm;
-
-    memset(&tm,0,sizeof(tm));
-    tm.tm_year=94;
-    tm.tm_mday=1;
-    return(mktime(&tm)-0x2D24BD00L);
-}
-
 static void recverror(SOCKET socket, int rd, int line)
 {
 	if(rd==0) 
@@ -4360,16 +4350,8 @@ void DLLCALL mail_server(void* arg)
 		if(startup->host_name[0]==0)
 			SAFECOPY(startup->host_name,scfg.sys_inetaddr);
 
-		if(!(scfg.sys_misc&SM_LOCAL_TZ) && !(startup->options&MAIL_OPT_LOCAL_TIMEZONE)) {
-			if(putenv("TZ=UTC0"))
-				lprintf(LOG_ERR,"!putenv() FAILED");
-			tzset();
-
-			if((t=checktime())!=0) {   /* Check binary time */
-				lprintf(LOG_ERR,"!TIME PROBLEM (%ld)",t);
-				cleanup(1);
-				return;
-			}
+		if((t=checktime())!=0) {   /* Check binary time */
+			lprintf(LOG_ERR,"!TIME PROBLEM (%ld)",t);
 		}
 
 		if(uptime==0)
diff --git a/src/sbbs3/mailsrvr.h b/src/sbbs3/mailsrvr.h
index c66a6fc603..8652ad105d 100644
--- a/src/sbbs3/mailsrvr.h
+++ b/src/sbbs3/mailsrvr.h
@@ -146,13 +146,12 @@ static struct init_field mail_init_fields[] = {
 #define MAIL_OPT_RELAY_AUTH_CRAM_MD5	(1<<25)
 #define MAIL_OPT_NO_AUTO_EXEMPT			(1<<26)	/* Do not auto DNSBL-exempt recipient e-mail addresses */
 #define MAIL_OPT_NO_RECYCLE				(1<<27)	/* Disable recycling of server		*/
-#define MAIL_OPT_LOCAL_TIMEZONE			(1<<30)	/* Don't force UTC/GMT */
 #define MAIL_OPT_MUTE					(1<<31)
 
 #define MAIL_OPT_RELAY_AUTH_MASK		(MAIL_OPT_RELAY_AUTH_PLAIN|MAIL_OPT_RELAY_AUTH_LOGIN|MAIL_OPT_RELAY_AUTH_CRAM_MD5)
 
 /* mail_startup_t.options bits that require re-init/recycle when changed */
-#define MAIL_INIT_OPTS	(MAIL_OPT_ALLOW_POP3|MAIL_OPT_NO_SENDMAIL|MAIL_OPT_LOCAL_TIMEZONE)
+#define MAIL_INIT_OPTS	(MAIL_OPT_ALLOW_POP3|MAIL_OPT_NO_SENDMAIL)
 
 #if defined(STARTUP_INI_BITDESC_TABLES)
 static ini_bitdesc_t mail_options[] = {
@@ -185,7 +184,6 @@ static ini_bitdesc_t mail_options[] = {
 	{ MAIL_OPT_RELAY_AUTH_CRAM_MD5	,"RELAY_AUTH_CRAM_MD5"	},
 	{ MAIL_OPT_NO_AUTO_EXEMPT		,"NO_AUTO_EXEMPT"		},
 	{ MAIL_OPT_NO_RECYCLE			,"NO_RECYCLE"			},
-	{ MAIL_OPT_LOCAL_TIMEZONE		,"LOCAL_TIMEZONE"		},
 	{ MAIL_OPT_MUTE					,"MUTE"					},
 	/* terminator */
 	{ 0 							,NULL					}
diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp
index d3eaa67be6..592cf7b8e1 100644
--- a/src/sbbs3/main.cpp
+++ b/src/sbbs3/main.cpp
@@ -4029,16 +4029,6 @@ void sbbs_t::daily_maint(void)
 	}
 }
 
-time_t checktime(void)
-{
-	struct tm tm;
-
-    memset(&tm,0,sizeof(tm));
-    tm.tm_year=94;
-    tm.tm_mday=1;
-    return(mktime(&tm)-0x2D24BD00L);
-}
-
 const char* DLLCALL js_ver(void)
 {
 #ifdef JAVASCRIPT
@@ -4311,16 +4301,8 @@ void DLLCALL bbs_thread(void* arg)
 	if(startup->host_name[0]==0)
 		SAFECOPY(startup->host_name,scfg.sys_inetaddr);
 
-	if(!(scfg.sys_misc&SM_LOCAL_TZ) && !(startup->options&BBS_OPT_LOCAL_TIMEZONE)) {
-		if(putenv("TZ=UTC0"))
-			lprintf(LOG_ERR,"!putenv() FAILED");
-		tzset();
-
-		if((t=checktime())!=0) {   /* Check binary time */
-			lprintf(LOG_ERR,"!TIME PROBLEM (%ld)",t);
-			cleanup(1);
-			return;
-		}
+	if((t=checktime())!=0) {   /* Check binary time */
+		lprintf(LOG_ERR,"!TIME PROBLEM (%ld)",t);
 	}
 
 	if(uptime==0)
diff --git a/src/sbbs3/makeuser.c b/src/sbbs3/makeuser.c
index e82ccc8e77..657dbcb1d6 100644
--- a/src/sbbs3/makeuser.c
+++ b/src/sbbs3/makeuser.c
@@ -125,9 +125,6 @@ int main(int argc, char **argv)
 		exit(1);
 	}
 
-	if(!(scfg.sys_misc&SM_LOCAL_TZ))
-		putenv("TZ=UTC0");
-
 	now=time(NULL);
 
 	memset(&user,0,sizeof(user));
diff --git a/src/sbbs3/sbbscon.c b/src/sbbs3/sbbscon.c
index dbbd32dbe6..6be476864a 100644
--- a/src/sbbs3/sbbscon.c
+++ b/src/sbbs3/sbbscon.c
@@ -8,7 +8,7 @@
  * @format.tab-size 4		(Plain Text/Source Code File Header)			*
  * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
  *																			*
- * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html		*
+ * Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html		*
  *																			*
  * This program is free software; you can redistribute it and/or			*
  * modify it under the terms of the GNU General Public License				*
@@ -173,7 +173,6 @@ static const char* usage  = "\nusage: %s [[setting] [...]] [path/ini_file]\n"
 #ifdef __unix__
 							"\tnd         do not read run as daemon - overrides .ini file\n"
 #endif
-							"\tlt         use local timezone (do not force UTC/GMT)\n"
 							"\tdefaults   show default settings and options\n"
 							"\n"
 							;
@@ -1659,19 +1658,6 @@ int main(int argc, char** argv)
 						return(1);
 				}
 				break;
-			case 'L':	/* Local */
-				switch(toupper(*(arg++))) {
-					case 'T': /* timezone */
-						bbs_startup.options		|=BBS_OPT_LOCAL_TIMEZONE;
-						ftp_startup.options		|=BBS_OPT_LOCAL_TIMEZONE;
-						mail_startup.options	|=BBS_OPT_LOCAL_TIMEZONE;
-						services_startup.options|=BBS_OPT_LOCAL_TIMEZONE;
-						break;
-					default:
-						show_usage(argv[0]);
-						return(1);
-				}
-				break;
 
 			default:
 				show_usage(argv[0]);
diff --git a/src/sbbs3/sbbsdefs.h b/src/sbbs3/sbbsdefs.h
index 44ee0ed041..5fdb2a8f0d 100644
--- a/src/sbbs3/sbbsdefs.h
+++ b/src/sbbs3/sbbsdefs.h
@@ -153,7 +153,7 @@ typedef struct {
 #define SM_CELERITY		(1L<<10)	/* Expand Celerity color codes in messages	*/
 #define SM_RENEGADE		(1L<<11)	/* Expand Renegade color codes in messages	*/
 #define SM_ECHO_PW		(1L<<12)	/* Echo passwords locally					*/
-#define SM_LOCAL_TZ		(1L<<13)	/* Use local timezone representations		*/
+#define SM_UNUSED		(1L<<13)	/* Defaults to *on*	(used to SM_LOCAL_TZ)	*/
 #define SM_AUTO_DST		(1L<<14)	/* Automatic Daylight Savings Toggle (US)   */
 #define SM_R_SYSOP		(1L<<15)	/* Allow remote sysop logon/commands		*/
 #define SM_QUOTE_EM		(1L<<16)	/* Allow quoting of e-mail					*/
diff --git a/src/sbbs3/services.c b/src/sbbs3/services.c
index fd75596301..fc8e857ce0 100644
--- a/src/sbbs3/services.c
+++ b/src/sbbs3/services.c
@@ -250,16 +250,6 @@ static void status(char* str)
 	    startup->status(startup->cbdata,str);
 }
 
-static time_t checktime(void)
-{
-	struct tm tm;
-
-    memset(&tm,0,sizeof(tm));
-    tm.tm_year=94;
-    tm.tm_mday=1;
-    return(mktime(&tm)-0x2D24BD00L);
-}
-
 /* Global JavaScript Methods */
 
 static JSBool
@@ -1737,16 +1727,8 @@ void DLLCALL services_thread(void* arg)
 		if(startup->host_name[0]==0)
 			SAFECOPY(startup->host_name,scfg.sys_inetaddr);
 
-		if(!(scfg.sys_misc&SM_LOCAL_TZ) && !(startup->options&BBS_OPT_LOCAL_TIMEZONE)) {
-			if(putenv("TZ=UTC0"))
-				lprintf(LOG_ERR,"!putenv() FAILED");
-			tzset();
-
-			if((t=checktime())!=0) {   /* Check binary time */
-				lprintf(LOG_ERR,"!TIME PROBLEM (%ld)",t);
-				cleanup(1);
-				return;
-			}
+		if((t=checktime())!=0) {   /* Check binary time */
+			lprintf(LOG_ERR,"!TIME PROBLEM (%ld)",t);
 		}
 
 		if(uptime==0)
diff --git a/src/sbbs3/services.h b/src/sbbs3/services.h
index 4b62cc879e..3dd367f080 100644
--- a/src/sbbs3/services.h
+++ b/src/sbbs3/services.h
@@ -98,7 +98,7 @@ static struct init_field services_init_fields[] = {
 #define SERVICE_OPT_FULL_ACCEPT	(1<<4)	/* Accept/close connections when server is full */
 
 /* services_startup_t.options bits that require re-init/recycle when changed */
-#define SERVICE_INIT_OPTS	(BBS_OPT_LOCAL_TIMEZONE)
+#define SERVICE_INIT_OPTS	(0)
 
 #if defined(STARTUP_INI_BITDESC_TABLES) || defined(SERVICES_INI_BITDESC_TABLE)
 static ini_bitdesc_t service_options[] = {
diff --git a/src/sbbs3/startup.h b/src/sbbs3/startup.h
index 15e9e07c66..7613347f59 100644
--- a/src/sbbs3/startup.h
+++ b/src/sbbs3/startup.h
@@ -160,12 +160,11 @@ static struct init_field {
 #define BBS_OPT_NO_RECYCLE			(1<<27)	/* Disable recycling of server		*/
 #define BBS_OPT_GET_IDENT			(1<<28)	/* Get Identity (RFC 1413)			*/
 #define BBS_OPT_NO_JAVASCRIPT		(1<<29)	/* JavaScript disabled				*/
-#define BBS_OPT_LOCAL_TIMEZONE		(1<<30)	/* Don't force UTC/GMT				*/
 #define BBS_OPT_MUTE				(1<<31)	/* Mute sounds						*/
 
 /* bbs_startup_t.options bits that require re-init/recycle when changed */
 #define BBS_INIT_OPTS	(BBS_OPT_ALLOW_RLOGIN|BBS_OPT_ALLOW_SSH|BBS_OPT_NO_EVENTS|BBS_OPT_NO_SPY_SOCKETS \
-						|BBS_OPT_NO_JAVASCRIPT|BBS_OPT_LOCAL_TIMEZONE)
+						|BBS_OPT_NO_JAVASCRIPT)
 
 #if defined(STARTUP_INI_BITDESC_TABLES)
 static ini_bitdesc_t bbs_options[] = {
@@ -185,7 +184,6 @@ static ini_bitdesc_t bbs_options[] = {
 	{ BBS_OPT_NO_RECYCLE			,"NO_RECYCLE"			},
 	{ BBS_OPT_GET_IDENT				,"GET_IDENT"			},
 	{ BBS_OPT_NO_JAVASCRIPT			,"NO_JAVASCRIPT"		},
-	{ BBS_OPT_LOCAL_TIMEZONE		,"LOCAL_TIMEZONE"		},
 	{ BBS_OPT_MUTE					,"MUTE"					},
 	/* terminator */										
 	{ 0								,NULL					}
diff --git a/src/sbbs3/websrvr.c b/src/sbbs3/websrvr.c
index e60682f708..d5e8ef7ce4 100644
--- a/src/sbbs3/websrvr.c
+++ b/src/sbbs3/websrvr.c
@@ -5352,12 +5352,6 @@ void DLLCALL web_server(void* arg)
 		if(startup->host_name[0]==0)
 			SAFECOPY(startup->host_name,scfg.sys_inetaddr);
 
-		if(!(scfg.sys_misc&SM_LOCAL_TZ) && !(startup->options&BBS_OPT_LOCAL_TIMEZONE)) {
-			if(putenv("TZ=UTC0"))
-				lprintf(LOG_WARNING,"!putenv() FAILED");
-			tzset();
-		}
-
 		if(uptime==0)
 			uptime=time(NULL);	/* this must be done *after* setting the timezone */
 
diff --git a/src/sbbs3/websrvr.h b/src/sbbs3/websrvr.h
index e7a30901ad..fb44812e7c 100644
--- a/src/sbbs3/websrvr.h
+++ b/src/sbbs3/websrvr.h
@@ -121,7 +121,7 @@ static struct init_field web_init_fields[] = {
 #define WEB_OPT_HTTP_LOGGING		(1<<6)	/* Create/write-to HttpLogFile		*/
 
 /* web_startup_t.options bits that require re-init/recycle when changed */
-#define WEB_INIT_OPTS	(BBS_OPT_LOCAL_TIMEZONE|WEB_OPT_HTTP_LOGGING)
+#define WEB_INIT_OPTS	(WEB_OPT_HTTP_LOGGING)
 
 #if defined(STARTUP_INI_BITDESC_TABLES)
 static ini_bitdesc_t web_options[] = {
@@ -138,7 +138,6 @@ static ini_bitdesc_t web_options[] = {
 	{ BBS_OPT_NO_RECYCLE			,"NO_RECYCLE"			},
 	{ BBS_OPT_GET_IDENT				,"GET_IDENT"			},
 	{ BBS_OPT_NO_JAVASCRIPT			,"NO_JAVASCRIPT"		},
-	{ BBS_OPT_LOCAL_TIMEZONE		,"LOCAL_TIMEZONE"		},
 	{ BBS_OPT_MUTE					,"MUTE"					},
 
 	/* terminator */										
-- 
GitLab