diff --git a/src/sbbs3/js_system.c b/src/sbbs3/js_system.c
index a97cb7da1eca808b765c08a056f83cd6bf2ad2f2..d2c93e0eea19a8070e4925fb881a4ca6e1b1f4ea 100644
--- a/src/sbbs3/js_system.c
+++ b/src/sbbs3/js_system.c
@@ -1003,7 +1003,6 @@ js_timestr(JSContext *cx, uintN argc, jsval *arglist)
 	jsval *argv=JS_ARGV(cx, arglist);
 	char		str[128];
 	int32		i=0;
-	time_t		t;
 	JSString*	js_str;
 	scfg_t*		cfg;
 	jsrefcount	rc;
@@ -1014,12 +1013,11 @@ js_timestr(JSContext *cx, uintN argc, jsval *arglist)
 		return(JS_FALSE);
 
 	if(argc<1)
-		i=time(NULL);	/* use current time */
+		i=(int32_t)time(NULL);	/* use current time */
 	else
 		JS_ValueToInt32(cx,argv[0],&i);
-	t=i;
 	rc=JS_SUSPENDREQUEST(cx);
-	timestr(cfg,t,str);
+	timestr(cfg,i,str);
 	JS_RESUMEREQUEST(cx, rc);
 	if((js_str = JS_NewStringCopyZ(cx, str))==NULL)
 		return(JS_FALSE);
@@ -1035,7 +1033,7 @@ js_datestr(JSContext *cx, uintN argc, jsval *arglist)
 	JSObject *obj=JS_THIS_OBJECT(cx, arglist);
 	jsval *argv=JS_ARGV(cx, arglist);
 	char		str[128];
-	time_t		t;
+	time32_t	t;
 	JSString*	js_str;
 	scfg_t*		cfg;
 	char		*p;
@@ -1046,14 +1044,14 @@ js_datestr(JSContext *cx, uintN argc, jsval *arglist)
 		return(JS_FALSE);
 
 	if(argc<1)
-		t=time(NULL);	/* use current time */
+		t=time32(NULL);	/* use current time */
 	else {
 		if(JSVAL_IS_STRING(argv[0])) {	/* convert from string to time_t? */
 			JSVALUE_TO_STRING(cx, argv[0], p, NULL);
 			JS_SET_RVAL(cx, arglist, DOUBLE_TO_JSVAL((double)dstrtounix(cfg, p)));
 			return(JS_TRUE);
 		}
-		JS_ValueToInt32(cx,argv[0],(int32*)&t);
+		JS_ValueToInt32(cx,argv[0],&t);
 	}
 	unixtodstr(cfg,t,str);
 	if((js_str = JS_NewStringCopyZ(cx, str))==NULL)
@@ -1421,7 +1419,7 @@ js_new_user(JSContext *cx, uintN argc, jsval *arglist)
 	SAFECOPY(user.alias,alias);
 
 	/* statistics */
-	user.firston=user.laston=user.pwmod=time(NULL);
+	user.firston=user.laston=user.pwmod=time32(NULL);
 
 	/* security */
 	user.level=cfg->new_level;
diff --git a/src/sbbs3/js_user.c b/src/sbbs3/js_user.c
index e2e01f9ef34d823989da9ee4a43498f6e88b7dfa..8e1ab7ffc098f0c261d57e0822c9a66df3117ac5 100644
--- a/src/sbbs3/js_user.c
+++ b/src/sbbs3/js_user.c
@@ -144,7 +144,7 @@ static JSBool js_user_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 	jsval idval;
 	char*		s=NULL;
 	char		tmp[128];
-	ulong		val=0;
+	uint64_t	val=0;
     jsint       tiny;
 	JSString*	js_str;
 	private_t*	p;
@@ -557,7 +557,7 @@ static JSBool js_user_set(JSContext *cx, JSObject *obj, jsid id, JSBool strict,
 		case USER_PROP_LOGONTIME:	 
 			JS_RESUMEREQUEST(cx, rc);
 			if(JS_ValueToInt32(cx,*vp,&val))
-				putuserrec(p->cfg,p->user->number,U_LOGONTIME,0,ultoa(p->user->logontime=val,tmp,16));
+				putuserrec(p->cfg,p->user->number,U_LOGONTIME,0,ultoa((ulong)p->user->logontime=val,tmp,16));
 			rc=JS_SUSPENDREQUEST(cx);
 			break;
 			
@@ -569,7 +569,7 @@ static JSBool js_user_set(JSContext *cx, JSObject *obj, jsid id, JSBool strict,
 		case USER_PROP_PWMOD:
 			JS_RESUMEREQUEST(cx, rc);
 			if(JS_ValueToInt32(cx,*vp,&val))
-				putuserrec(p->cfg,p->user->number,U_PWMOD,0,ultoa(p->user->pwmod=val,tmp,16));
+				putuserrec(p->cfg,p->user->number,U_PWMOD,0,ultoa((ulong)p->user->pwmod=val,tmp,16));
 			rc=JS_SUSPENDREQUEST(cx);
 			break;
 		case USER_PROP_LEVEL: 
@@ -631,7 +631,7 @@ static JSBool js_user_set(JSContext *cx, JSObject *obj, jsid id, JSBool strict,
 		case USER_PROP_EXPIRE:  
 			JS_RESUMEREQUEST(cx, rc);
 			if(JS_ValueToInt32(cx,*vp,&val))
-				putuserrec(p->cfg,p->user->number,U_EXPIRE,0,ultoa(p->user->expire=val,tmp,16));
+				putuserrec(p->cfg,p->user->number,U_EXPIRE,0,ultoa((ulong)p->user->expire=val,tmp,16));
 			rc=JS_SUSPENDREQUEST(cx);
 			break;
 
@@ -1097,7 +1097,7 @@ js_get_time_left(JSContext *cx, uintN argc, jsval *arglist)
 	rc=JS_SUSPENDREQUEST(cx);
 	js_getuserdat(p);
 
-	JS_SET_RVAL(cx, arglist, INT_TO_JSVAL(gettimeleft(p->cfg, p->user, (time_t)start_time)));
+	JS_SET_RVAL(cx, arglist, INT_TO_JSVAL((int32_t)gettimeleft(p->cfg, p->user, start_time)));
 	JS_RESUMEREQUEST(cx, rc);
 
 	return JS_TRUE;
diff --git a/src/sbbs3/listfile.cpp b/src/sbbs3/listfile.cpp
index 5f1dc6e836d32b6383bef77f18f152b7321ce85a..7a2ef3af15182b9b8258b1d341a095c5d5dbd8a7 100644
--- a/src/sbbs3/listfile.cpp
+++ b/src/sbbs3/listfile.cpp
@@ -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 2010 Rob Swindell - http://www.synchro.net/copyright.html		*
+ * Copyright 2011 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				*
@@ -627,7 +627,7 @@ bool sbbs_t::movefile(file_t* f, int newdir)
 	}
 	getextdesc(&cfg,olddir,f->datoffset,ext);
 	if(cfg.dir[olddir]->misc&DIR_MOVENEW)
-		f->dateuled=time(NULL);
+		f->dateuled=time32(NULL);
 	unpadfname(f->name,fname);
 	removefiledat(&cfg,f);
 	f->dir=newdir;
diff --git a/src/sbbs3/logfile.cpp b/src/sbbs3/logfile.cpp
index a4634cc0ba3ef1fe4fe2c2db258af4c5bbd4234e..d15a2a7257d64ade0c15c0a69da9d4bdb1f253d0 100644
--- a/src/sbbs3/logfile.cpp
+++ b/src/sbbs3/logfile.cpp
@@ -43,7 +43,7 @@ extern "C" BOOL DLLCALL hacklog(scfg_t* cfg, char* prot, char* user, char* text,
 	char	tstr[64];
 	char	fname[MAX_PATH+1];
 	int		file;
-	time_t	now=time(NULL);
+	time32_t now=time32(NULL);
 
 	sprintf(fname,"%shack.log",cfg->logs_dir);
 
@@ -81,7 +81,7 @@ extern "C" BOOL DLLCALL spamlog(scfg_t* cfg, char* prot, char* action
 	char	tstr[64];
 	char	fname[MAX_PATH+1];
 	int		file;
-	time_t	now=time(NULL);
+	time32_t now=time32(NULL);
 
 	sprintf(fname,"%sspam.log",cfg->logs_dir);
 
@@ -124,7 +124,7 @@ extern "C" int DLLCALL errorlog(scfg_t* cfg, const char* host, const char* text)
 	sprintf(path,"%serror.log",cfg->logs_dir);
 	if((fp=fnopen(NULL,path,O_WRONLY|O_CREAT|O_APPEND))==NULL)
 		return -1; 
-	fprintf(fp,"%s %s\r\n%s\r\n\r\n", timestr(cfg,time(NULL),buf), host==NULL ? "":host, text);
+	fprintf(fp,"%s %s\r\n%s\r\n\r\n", timestr(cfg,time32(NULL),buf), host==NULL ? "":host, text);
 	fclose(fp);
 	return 0;
 }
diff --git a/src/sbbs3/logon.cpp b/src/sbbs3/logon.cpp
index 0ab90a849bbf8148fe5aba0f33882f9133c64c65..956aff3322e0224ed8d6ac8e365c5040ed1bf441 100644
--- a/src/sbbs3/logon.cpp
+++ b/src/sbbs3/logon.cpp
@@ -189,7 +189,7 @@ bool sbbs_t::logon()
 	logon_ml=useron.level;
 	logontime=time(NULL);
 	starttime=logontime;
-	useron.logontime=logontime;
+	useron.logontime=(time32_t)logontime;
 	last_ns_time=ns_time=useron.ns_time;
 	// ns_time-=(useron.tlast*60); /* file newscan time == last logon time */
 	delfiles(cfg.temp_dir,ALLFILES);
@@ -206,7 +206,7 @@ bool sbbs_t::logon()
 	CLS;
 	if(useron.rows)
 		rows=useron.rows;
-	unixtodstr(&cfg,logontime,str);
+	unixtodstr(&cfg,(time32_t)logontime,str);
 	if(!strncmp(str,useron.birth,5) && !(useron.rest&FLAG('Q'))) {
 		bputs(text[HappyBirthday]);
 		pause();
@@ -260,8 +260,8 @@ bool sbbs_t::logon()
 				break; 
 			}
 			strcpy(useron.pass,str);
-			useron.pwmod=time(NULL);
-			putuserrec(&cfg,useron.number,U_PWMOD,8,ultoa(useron.pwmod,str,16));
+			useron.pwmod=time32(NULL);
+			putuserrec(&cfg,useron.number,U_PWMOD,8,ultoa((ulong)useron.pwmod,str,16));
 			bputs(text[PasswordChanged]);
 			pause(); 
 		}
@@ -556,9 +556,9 @@ ulong sbbs_t::logonstats()
 	read(dsts,&stats.logons,4);		/* Total number of logons on system */
 	close(dsts);
 	now=time(NULL);
-	now32=now;
+	now32=(time32_t)now;
 	if(update_t>now+(24L*60L*60L)) /* More than a day in the future? */
-		errormsg(WHERE,ERR_CHK,"Daily stats time stamp",update_t);
+		errormsg(WHERE,ERR_CHK,"Daily stats time stamp",(ulong)update_t);
 	if(localtime_r(&update_t,&update_tm)==NULL)
 		return(0);
 	if(localtime_r(&now,&tm)==NULL)
diff --git a/src/sbbs3/logout.cpp b/src/sbbs3/logout.cpp
index c58922df0a9ebb3128befaea838b0f40d8e16e47..1b95c2faae3ca40e72cecbf9f598ba86117cc4e3 100644
--- a/src/sbbs3/logout.cpp
+++ b/src/sbbs3/logout.cpp
@@ -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 2010 Rob Swindell - http://www.synchro.net/copyright.html		*
+ * Copyright 2011 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				*
@@ -124,7 +124,7 @@ void sbbs_t::logout()
 	putmsgptrs();
 	if(!REALSYSOP)
 		logofflist();
-	useron.laston=now;
+	useron.laston=(time32_t)now;
 
 	ttoday=useron.ttoday-useron.textra; 		/* billable time used prev calls */
 	if(ttoday>=cfg.level_timeperday[useron.level])
@@ -133,7 +133,7 @@ void sbbs_t::logout()
 		i=cfg.level_timeperday[useron.level]-ttoday;
 	if(i>cfg.level_timepercall[useron.level])      /* i=amount of time without min */
 		i=cfg.level_timepercall[useron.level];
-	j=(now-starttime)/60;			/* j=billable time online in min */
+	j=(int)(now-starttime)/60;			/* j=billable time online in min */
 	if(i<0) i=0;
 	if(j<0) j=0;
 
@@ -152,7 +152,7 @@ void sbbs_t::logout()
 		useron.textra+=(ushort)((starttime-logontime)/60);
 
 	putuserrec(&cfg,useron.number,U_TEXTRA,5,ultoa(useron.textra,str,10));
-	putuserrec(&cfg,useron.number,U_NS_TIME,8,ultoa(last_ns_time,str,16));
+	putuserrec(&cfg,useron.number,U_NS_TIME,8,ultoa((ulong)last_ns_time,str,16));
 
 	logoutuserdat(&cfg, &useron, now, logontime);
 
diff --git a/src/sbbs3/mail.cpp b/src/sbbs3/mail.cpp
index 9e27e81dd12171c223524a0bef310a6d9f783882..863754ce89728275c3dd26a9aa3cbbf542a5a384 100644
--- a/src/sbbs3/mail.cpp
+++ b/src/sbbs3/mail.cpp
@@ -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 2010 Rob Swindell - http://www.synchro.net/copyright.html		*
+ * Copyright 2011 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				*
@@ -43,7 +43,8 @@
 /****************************************************************************/
 int sbbs_t::delmail(uint usernumber, int which)
 {
-	ulong	 i,l,now;
+	ulong	i,l;
+	time_t	now;
 	idxrec_t *idxbuf;
 	smbmsg_t msg;
 
diff --git a/src/sbbs3/mailsrvr.c b/src/sbbs3/mailsrvr.c
index fb84b8cbbfe915ed40058fae8a445aaae1399b32..29f8ae4a19acda4d233076c1088c3d8c6b7e6f97 100644
--- a/src/sbbs3/mailsrvr.c
+++ b/src/sbbs3/mailsrvr.c
@@ -834,7 +834,7 @@ static void pop3_thread(void* arg)
 
 	/* Initialize client display */
 	client.size=sizeof(client);
-	client.time=time(NULL);
+	client.time=time32(NULL);
 	SAFECOPY(client.addr,host_ip);
 	SAFECOPY(client.host,host_name);
 	client.port=ntohs(pop3.client_addr.sin_port);
@@ -1501,7 +1501,7 @@ static void exempt_email_addr(const char* comment
 			if(fromext!=NULL)
 				fprintf(fp,"#%s ",fromext);
 			fprintf(fp,"%s on %s\n%s\n"
-				,fromaddr, timestr(&scfg,time(NULL),tmp), to);
+				,fromaddr, timestr(&scfg,time32(NULL),tmp), to);
 			fclose(fp);
 		}
 	}
@@ -2490,7 +2490,7 @@ static void smtp_thread(void* arg)
 
 	/* Initialize client display */
 	client.size=sizeof(client);
-	client.time=time(NULL);
+	client.time=time32(NULL);
 	SAFECOPY(client.addr,host_ip);
 	SAFECOPY(client.host,host_name);
 	client.port=ntohs(smtp.client_addr.sin_port);
diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp
index acc76eb22ab20cf6d662e806e8e641f8b2db275e..26e1df9da1d8e1970dc46d76dd15a767aa74c265 100644
--- a/src/sbbs3/main.cpp
+++ b/src/sbbs3/main.cpp
@@ -302,7 +302,7 @@ DLLEXPORT void DLLCALL sbbs_srand()
 		close(rf);
 	}
 #else
-	seed = time(NULL) ^ (DWORD)GetCurrentThreadId();
+	seed = time32(NULL) ^ (DWORD)GetCurrentThreadId();
 #endif
 
  	srand(seed);
@@ -2409,7 +2409,7 @@ void event_thread(void* arg)
 						sbbs->online=FALSE;
 					} 
 				}
-				lastprepack=now;
+				lastprepack=(time32_t)now;
 				SAFEPRINTF(str,"%stime.dab",sbbs->cfg.ctrl_dir);
 				if((file=sbbs->nopen(str,O_WRONLY))==-1) {
 					sbbs->errormsg(WHERE,ERR_OPEN,str,O_WRONLY);
@@ -2580,7 +2580,7 @@ void event_thread(void* arg)
 				}
 				delfiles(sbbs->cfg.temp_dir,ALLFILES);
 
-				sbbs->cfg.qhub[i]->last=time(NULL);
+				sbbs->cfg.qhub[i]->last=time32(NULL);
 				SAFEPRINTF(str,"%sqnet.dab",sbbs->cfg.ctrl_dir);
 				if((file=sbbs->nopen(str,O_WRONLY))==-1) {
 					sbbs->errormsg(WHERE,ERR_OPEN,str,O_WRONLY);
@@ -2622,7 +2622,7 @@ void event_thread(void* arg)
 				&& (now_tm.tm_mday!=tm.tm_mday || now_tm.tm_mon!=tm.tm_mon)))
 				&& sbbs->cfg.phub[i]->days&(1<<now_tm.tm_wday))) {
 
-				sbbs->cfg.phub[i]->last=time(NULL);
+				sbbs->cfg.phub[i]->last=time32(NULL);
 				SAFEPRINTF(str,"%spnet.dab",sbbs->cfg.ctrl_dir);
 				if((file=sbbs->nopen(str,O_WRONLY))==-1) {
 					sbbs->errormsg(WHERE,ERR_OPEN,str,O_WRONLY);
@@ -2705,7 +2705,7 @@ void event_thread(void* arg)
 							SAFEPRINTF(str,"%stime.dab",sbbs->cfg.ctrl_dir);
 							if((file=sbbs->nopen(str,O_RDONLY))==-1) {
 								sbbs->errormsg(WHERE,ERR_OPEN,str,O_RDONLY);
-								sbbs->cfg.event[i]->last=now;
+								sbbs->cfg.event[i]->last=(time32_t)now;
 								continue; 
 							}
 							lseek(file,(long)i*4L,SEEK_SET);
@@ -2721,7 +2721,7 @@ void event_thread(void* arg)
 						SAFEPRINTF2(str,"%s%s.now",sbbs->cfg.data_dir,sbbs->cfg.event[i]->code);
 						if(fexistcase(str))
 							remove(str);
-						sbbs->cfg.event[i]->last=now;
+						sbbs->cfg.event[i]->last=(time32_t)now;
 					} else {	// Exclusive event to run on a node under our control
 						eprintf(LOG_INFO,"Waiting for all nodes to become inactive before "
 							"running timed event: %s",sbbs->cfg.event[i]->code);
@@ -2780,7 +2780,7 @@ void event_thread(void* arg)
 					|| sbbs->cfg.event[i]->node>last_node) {
 					eprintf(LOG_NOTICE,"Changing node status for nodes %d through %d to WFC"
 						,first_node,last_node);
-					sbbs->cfg.event[i]->last=now;
+					sbbs->cfg.event[i]->last=(time32_t)now;
 					for(j=first_node;j<=last_node;j++) {
 						node.status=NODE_INVALID_STATUS;
 						if(sbbs->getnodedat(j,&node,1)!=0)
@@ -2822,7 +2822,7 @@ void event_thread(void* arg)
 						if(!(ex_mode&EX_BG))
 							eprintf(LOG_INFO,"Timed event: %s returned %d",strupr(str), result);
 					}
-					sbbs->cfg.event[i]->last=time(NULL);
+					sbbs->cfg.event[i]->last=time32(NULL);
 					SAFEPRINTF(str,"%stime.dab",sbbs->cfg.ctrl_dir);
 					if((file=sbbs->nopen(str,O_WRONLY))==-1) {
 						sbbs->errormsg(WHERE,ERR_OPEN,str,O_WRONLY);
@@ -3884,8 +3884,8 @@ void sbbs_t::logoffstats()
 		read(file,&stats,sizeof(stats));  
 
 		if(!(useron.rest&FLAG('Q'))) {	/* Don't count QWKnet nodes */
-			stats.timeon+=(now-logontime)/60;
-			stats.ttoday+=(now-logontime)/60;
+			stats.timeon+=(uint32_t)(now-logontime)/60;
+			stats.ttoday+=(uint32_t)(now-logontime)/60;
 			stats.ptoday+=logon_posts;
 		}
 		stats.uls+=logon_uls;
@@ -4172,7 +4172,7 @@ void sbbs_t::daily_maint(void)
 				user.exempt=sbbs->cfg.val_exempt[sbbs->cfg.level_expireto[user.level]];
 				user.rest=sbbs->cfg.val_rest[sbbs->cfg.level_expireto[user.level]];
 				if(sbbs->cfg.val_expire[sbbs->cfg.level_expireto[user.level]])
-					user.expire=now
+					user.expire=(time32_t)now
 						+(sbbs->cfg.val_expire[sbbs->cfg.level_expireto[user.level]]*24*60*60);
 				else
 					user.expire=0;
@@ -4196,7 +4196,7 @@ void sbbs_t::daily_maint(void)
 			putuserrec(&sbbs->cfg,user.number,U_FLAGS2,8,ultoa(user.flags2,str,16));
 			putuserrec(&sbbs->cfg,user.number,U_FLAGS3,8,ultoa(user.flags3,str,16));
 			putuserrec(&sbbs->cfg,user.number,U_FLAGS4,8,ultoa(user.flags4,str,16));
-			putuserrec(&sbbs->cfg,user.number,U_EXPIRE,8,ultoa(user.expire,str,16));
+			putuserrec(&sbbs->cfg,user.number,U_EXPIRE,8,ultoa((ulong)user.expire,str,16));
 			putuserrec(&sbbs->cfg,user.number,U_EXEMPT,8,ultoa(user.exempt,str,16));
 			putuserrec(&sbbs->cfg,user.number,U_REST,8,ultoa(user.rest,str,16));
 			if(sbbs->cfg.expire_mod[0]) {
@@ -5248,7 +5248,7 @@ NO_SSH:
 		}
 		/* Initialize client display */
 		client.size=sizeof(client);
-		client.time=time(NULL);
+		client.time=time32(NULL);
 		SAFECOPY(client.addr,host_ip);
 		SAFECOPY(client.host,host_name);
 		client.port=ntohs(client_addr.sin_port);
diff --git a/src/sbbs3/mime.c b/src/sbbs3/mime.c
index 514f558a6e12e9c8d11ebfc43692da11c61e5de6..0e64433d9e3df8f9dd530c33c609860fc4990f05 100644
--- a/src/sbbs3/mime.c
+++ b/src/sbbs3/mime.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 2003 Rob Swindell - http://www.synchro.net/copyright.html		*
+ * Copyright 2011 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				*
@@ -52,7 +52,7 @@ char* mimegetboundary()
     int		i, num;
     char*	boundaryString = (char*)malloc(SIZEOF_MIMEBOUNDARY + 1);
 
-    srand(time(NULL));
+    srand((unsigned int)time(NULL));
     if (boundaryString == NULL) 
         return NULL;
     for (i=0;i<SIZEOF_MIMEBOUNDARY;i++) {
diff --git a/src/sbbs3/netmail.cpp b/src/sbbs3/netmail.cpp
index d919ef010b5837740272ce8028bde6dfa847ee7d..35abda0ddfa9ba012db42fda0136d2a574f3d3d8 100644
--- a/src/sbbs3/netmail.cpp
+++ b/src/sbbs3/netmail.cpp
@@ -234,7 +234,7 @@ bool sbbs_t::inetmail(const char *into, const char *subj, long mode)
 	msg.hdr.version=smb_ver();
 	if(mode&WM_FILE)
 		msg.hdr.auxattr|=MSG_FILEATTACH;
-	msg.hdr.when_written.time=msg.hdr.when_imported.time=time(NULL);
+	msg.hdr.when_written.time=msg.hdr.when_imported.time=time32(NULL);
 	msg.hdr.when_written.zone=msg.hdr.when_imported.zone=sys_timezone(&cfg);
 
 	msg.hdr.offset=offset;
@@ -445,7 +445,7 @@ bool sbbs_t::qnetmail(const char *into, const char *subj, long mode)
 	msg.hdr.version=smb_ver();
 	if(mode&WM_FILE)
 		msg.hdr.auxattr|=MSG_FILEATTACH;
-	msg.hdr.when_written.time=msg.hdr.when_imported.time=time(NULL);
+	msg.hdr.when_written.time=msg.hdr.when_imported.time=time32(NULL);
 	msg.hdr.when_written.zone=msg.hdr.when_imported.zone=sys_timezone(&cfg);
 
 	msg.hdr.offset=offset;
diff --git a/src/sbbs3/newuser.cpp b/src/sbbs3/newuser.cpp
index 6875a224446beb1db8d0a5938b388900dc4d7cda..cd37af55ea3e9aa4c4aefd7e9c8fb9e82415ac2b 100644
--- a/src/sbbs3/newuser.cpp
+++ b/src/sbbs3/newuser.cpp
@@ -105,10 +105,10 @@ BOOL sbbs_t::newuser()
 	/* Sets defaults per sysop config */
 	useron.misc|=(cfg.new_misc&~(DELETED|INACTIVE|QUIET|NETMAIL));
 	useron.qwk=QWK_DEFAULT;
-	useron.firston=useron.laston=useron.pwmod=time(NULL);
+	useron.firston=useron.laston=useron.pwmod=time32(NULL);
 	if(cfg.new_expire) {
 		now=time(NULL);
-		useron.expire=now+((long)cfg.new_expire*24L*60L*60L); 
+		useron.expire=(time32_t)(now+((long)cfg.new_expire*24L*60L*60L)); 
 	} else
 		useron.expire=0;
 	useron.sex=' ';
diff --git a/src/sbbs3/postmsg.cpp b/src/sbbs3/postmsg.cpp
index aba68bb4fd25917a7b2b1413bfa07c21fc64e9c2..0c70b6238310d9341632d5b8b3d3e855cea26ca7 100644
--- a/src/sbbs3/postmsg.cpp
+++ b/src/sbbs3/postmsg.cpp
@@ -311,7 +311,7 @@ bool sbbs_t::postmsg(uint subnum, smbmsg_t *remsg, long wm_mode)
 	memset(&msg,0,sizeof(smbmsg_t));
 	msg.hdr.version=smb_ver();
 	msg.hdr.attr=msgattr;
-	msg.hdr.when_written.time=msg.hdr.when_imported.time=time(NULL);
+	msg.hdr.when_written.time=msg.hdr.when_imported.time=time32(NULL);
 	msg.hdr.when_written.zone=msg.hdr.when_imported.zone=sys_timezone(&cfg);
 
 	msg.hdr.number=smb.status.last_msg+1; /* this *should* be the new message number */
@@ -514,7 +514,7 @@ extern "C" int DLLCALL savemsg(scfg_t* cfg, smb_t* smb, smbmsg_t* msg, client_t*
 	}
 
 	if(msg->hdr.when_imported.time==0) {
-		msg->hdr.when_imported.time=time(NULL);
+		msg->hdr.when_imported.time=time32(NULL);
 		msg->hdr.when_imported.zone=sys_timezone(cfg);
 	}
 	if(msg->hdr.when_written.time==0)	/* Uninitialized */
diff --git a/src/sbbs3/qwk.cpp b/src/sbbs3/qwk.cpp
index ed9a19403be4a5b9be15dbd180c6f9066930564e..77dd06d0670424712ab59f371f70687c44a3ac95 100644
--- a/src/sbbs3/qwk.cpp
+++ b/src/sbbs3/qwk.cpp
@@ -208,7 +208,7 @@ void sbbs_t::update_qwkroute(char *via)
 			for(i=0;i<total_nodes;i++)
 				if(qwk_time[i]>t)
 					fprintf(stream,"%s %s:%s\r\n"
-						,unixtodstr(&cfg,qwk_time[i],str),qwk_node[i],qwk_path[i]);
+						,unixtodstr(&cfg,(time32_t)qwk_time[i],str),qwk_node[i],qwk_path[i]);
 			fclose(stream); 
 		}
 		else
@@ -806,12 +806,12 @@ void sbbs_t::qwk_sec()
 
 void sbbs_t::qwksetptr(uint subnum, char *buf, int reset)
 {
-	long	l;
+	long		l;
 	uint32_t	last;
 
 	if(buf[2]=='/' && buf[5]=='/') {    /* date specified */
-		l=dstrtounix(&cfg,buf);
-		subscan[subnum].ptr=getmsgnum(subnum,l);
+		time_t t=dstrtounix(&cfg,buf);
+		subscan[subnum].ptr=getmsgnum(subnum,t);
 		return; 
 	}
 	l=atol(buf);
diff --git a/src/sbbs3/qwktomsg.cpp b/src/sbbs3/qwktomsg.cpp
index 451a1a8dbc05b9711fb780a3d7c70618a1374de2..4512c04fab644b5080f62f21a29cedfc0a1aa93d 100644
--- a/src/sbbs3/qwktomsg.cpp
+++ b/src/sbbs3/qwktomsg.cpp
@@ -50,7 +50,7 @@ static void qwk_parse_header_list(smbmsg_t* msg, str_list_t* headers, bool parse
 	if((p=iniPopKey(headers,ROOT_SECTION,"WhenWritten",value))!=NULL) {
 		xpDateTime_t dt=isoDateTimeStr_parse(p);
 
-		msg->hdr.when_written.time=xpDateTime_to_time(dt);
+		msg->hdr.when_written.time=(uint32_t)xpDateTime_to_time(dt);
 		msg->hdr.when_written.zone=dt.zone;
 		sscanf(p,"%*s %s",zone);
 		if(zone[0])
@@ -183,7 +183,7 @@ void sbbs_t::qwk_new_msg(smbmsg_t* msg, char* hdrblk, long offset, str_list_t al
 		tm.tm_hour=((hdrblk[16]&0xf)*10)+(hdrblk[17]&0xf);
 		tm.tm_min=((hdrblk[19]&0xf)*10)+(hdrblk[20]&0xf);
 
-		msg->hdr.when_written.time=sane_mktime(&tm);
+		msg->hdr.when_written.time=(uint32_t)sane_mktime(&tm);
 	}
 
 	if(msg->to==NULL)
@@ -248,7 +248,7 @@ bool sbbs_t::qwk_import_msg(FILE *qwk_fp, char *hdrblk, ulong blocks
 	if(!(useron.rest&FLAG('Q')) && !fromhub && msg->hdr.when_written.zone==0)
 		msg->hdr.when_written.zone=sys_timezone(&cfg);
 
-	msg->hdr.when_imported.time=time(NULL);
+	msg->hdr.when_imported.time=time32(NULL);
 	msg->hdr.when_imported.zone=sys_timezone(&cfg);
 
 	hdrblk[116]=0;	// don't include number of blocks in "re: msg number"
diff --git a/src/sbbs3/sbbs.h b/src/sbbs3/sbbs.h
index 66443014d04ee0a7dce420631ced98c9beb78804..15093f39c02d40c234ea808d81d0f0b74be2807b 100644
--- a/src/sbbs3/sbbs.h
+++ b/src/sbbs3/sbbs.h
@@ -924,11 +924,11 @@ extern "C" {
 
 	/* date_str.c */
 	DLLEXPORT char *	DLLCALL zonestr(short zone);
-	DLLEXPORT time_t	DLLCALL dstrtounix(scfg_t*, char *str);
-	DLLEXPORT char *	DLLCALL unixtodstr(scfg_t*, time_t, char *str);
+	DLLEXPORT time32_t	DLLCALL dstrtounix(scfg_t*, char *str);
+	DLLEXPORT char *	DLLCALL unixtodstr(scfg_t*, time32_t, char *str);
 	DLLEXPORT char *	DLLCALL sectostr(uint sec, char *str);
 	DLLEXPORT char *	DLLCALL hhmmtostr(scfg_t* cfg, struct tm* tm, char* str);
-	DLLEXPORT char *	DLLCALL timestr(scfg_t* cfg, time_t intime, char* str);
+	DLLEXPORT char *	DLLCALL timestr(scfg_t* cfg, time32_t intime, char* str);
 	DLLEXPORT when_t	DLLCALL rfc822date(char* p);
 	DLLEXPORT char *	DLLCALL msgdate(when_t when, char* buf);
 
diff --git a/src/sbbs3/sbbscon.c b/src/sbbs3/sbbscon.c
index e7aa0ecc0f4646705e65235988dd36f70b28814b..0e7b2b862be4e0974019577a4ba7b9e92c4dfc4a 100644
--- a/src/sbbs3/sbbscon.c
+++ b/src/sbbs3/sbbscon.c
@@ -2114,7 +2114,7 @@ int main(int argc, char** argv)
 						count=0;
 						for(node=login_attempt_list.first; node!=NULL; node=node->next) {
 							login_attempt=node->data;
-							localtime_r(&login_attempt->time,&tm);
+							localtime32(&login_attempt->time,&tm);
 							printf("%u attempts (%u duplicate) from %s, last via %s on %u/%u %02u:%02u:%02u (user: %s, password: %s)\n"
 								,login_attempt->count
 								,login_attempt->dupes
@@ -2149,7 +2149,7 @@ int main(int argc, char** argv)
 						count=0;
 						for(node=client_list.first; node!=NULL; node=node->next) {
 							client=node->data;
-							localtime_r(&client->time,&tm);
+							localtime32(&client->time,&tm);
 							printf("%04d %s %s %s %s port %u since %u/%u %02u:%02u:%02u\n"
 								,node->tag
 								,client->protocol
diff --git a/src/sbbs3/sbbsdefs.h b/src/sbbs3/sbbsdefs.h
index 41bc4fa5ebe623be81e9ca89ca520424574cd681..bfd058f0a2555c9c185c7a1f1a1b378d9fcd55b0 100644
--- a/src/sbbs3/sbbsdefs.h
+++ b/src/sbbs3/sbbsdefs.h
@@ -949,7 +949,7 @@ typedef struct {						/* Users information */
 			cdt,						/* Credits */
 			min,						/* Minutes */
 			freecdt;					/* Free credits (renewed daily) */
-	time_t	firston,					/* Date/Time first called */
+	time32_t firston,					/* Date/Time first called */
 			laston, 					/* Last logoff date/time */
 			expire, 					/* Expiration date */
 			pwmod,						/* Password last modified */
diff --git a/src/sbbs3/scansubs.cpp b/src/sbbs3/scansubs.cpp
index 17599439ce78b7a817e1d8f8e6774168aca29f55..5aaa97ff98431cf96343990d0e32f2d3bb27a73e 100644
--- a/src/sbbs3/scansubs.cpp
+++ b/src/sbbs3/scansubs.cpp
@@ -265,7 +265,7 @@ void sbbs_t::new_scan_ptr_cfg()
 				if(j<99) outchar(' ');
 				t=getmsgtime(usrsub[i][j],subscan[usrsub[i][j]].ptr);
 				if(t>(long)l)
-					l=t;
+					l=(uint32_t)t;
 				bprintf(text[SubPtrLstFmt],j+1,cfg.sub[usrsub[i][j]]->lname
 					,timestr(t),nulstr); 
 			}
diff --git a/src/sbbs3/services.c b/src/sbbs3/services.c
index 5832140c413b5195f3d62dc696aee6d0d24ae348..7691a8c339f91edacbc177a102d5aaa7bee163e4 100644
--- a/src/sbbs3/services.c
+++ b/src/sbbs3/services.c
@@ -706,7 +706,7 @@ js_client_add(JSContext *cx, uintN argc, jsval *arglist)
 	memset(&client,0,sizeof(client));
 	client.size=sizeof(client);
 	client.protocol=service_client->service->protocol;
-	client.time=time(NULL);
+	client.time=time32(NULL);
 	client.user="<unknown>";
 	SAFECOPY(client.host,client.user);
 	
@@ -1135,7 +1135,7 @@ static void js_service_thread(void* arg)
 #endif
 
 	client.size=sizeof(client);
-	client.time=time(NULL);
+	client.time=time32(NULL);
 	SAFECOPY(client.addr,inet_ntoa(service_client.addr.sin_addr));
 	SAFECOPY(client.host,host_name);
 	client.port=ntohs(service_client.addr.sin_port);
@@ -1480,7 +1480,7 @@ static void native_service_thread(void* arg)
 #endif
 
 	client.size=sizeof(client);
-	client.time=time(NULL);
+	client.time=time32(NULL);
 	SAFECOPY(client.addr,inet_ntoa(service_client.addr.sin_addr));
 	SAFECOPY(client.host,host_name);
 	client.port=ntohs(service_client.addr.sin_port);
diff --git a/src/sbbs3/str.cpp b/src/sbbs3/str.cpp
index 68736998ccae2502c26d08d2bb66d578f090991a..5d36d3d65a572d415875bc73a55a8984f2848c20 100644
--- a/src/sbbs3/str.cpp
+++ b/src/sbbs3/str.cpp
@@ -566,7 +566,7 @@ bool sbbs_t::inputnstime32(time32_t *dt)
 	time_t	tmptime=*dt;
 
 	retval=inputnstime(&tmptime);
-	*dt=tmptime;
+	*dt=(time32_t)tmptime;
 	return(retval);
 }
 
@@ -838,7 +838,7 @@ bool sbbs_t::trashcan(const char *insearchof, const char *name)
 
 char* sbbs_t::timestr(time_t intime)
 {
-	return(::timestr(&cfg,intime,timestr_output));
+	return(::timestr(&cfg,(time32_t)intime,timestr_output));
 }
 
 void sbbs_t::sys_info()
@@ -889,7 +889,7 @@ void sbbs_t::user_info()
 
 	bprintf(text[UserStats],useron.alias,useron.number);
 
-	if(localtime_r(&useron.laston,&tm)!=NULL)
+	if(localtime32(&useron.laston,&tm)!=NULL)
 		bprintf(text[UserDates]
 			,unixtodstr(&cfg,useron.firston,str)
 			,unixtodstr(&cfg,useron.expire,tmp)
@@ -1132,7 +1132,7 @@ void sbbs_t::time_bank(void)
 		if(s<0) s=0;
 		if(s>cfg.level_timepercall[useron.level])
 			s=cfg.level_timepercall[useron.level];
-		s-=(now-starttime)/60;
+		s-=(int)(now-starttime)/60;
 		if(s<0) s=0;
 		bprintf(text[FreeMinLeft],s);
 		bprintf(text[UserMinutes],ultoac(useron.min,tmp));
diff --git a/src/sbbs3/un_qwk.cpp b/src/sbbs3/un_qwk.cpp
index 2e9b754195e35e6193d0e96efa1701c569bfe946..7b869502c64638d67f6b169e45d5bb215e3541d0 100644
--- a/src/sbbs3/un_qwk.cpp
+++ b/src/sbbs3/un_qwk.cpp
@@ -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 2010 Rob Swindell - http://www.synchro.net/copyright.html		*
+ * Copyright 2011 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				*
@@ -273,7 +273,7 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
 		if(j!=lastsub) {
 
 			if(msgs) {
-				t=time(NULL)-startsub;
+				t=(ulong)(time(NULL)-startsub);
 				if(t<1)
 					t=1;
 				eprintf(LOG_INFO,"Imported %lu QWK msgs in %lu seconds (%lu msgs/sec)", msgs,t,msgs/t);
@@ -371,7 +371,7 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
 	if(dir!=NULL)
 		closedir(dir);
 
-	t=time(NULL)-start;
+	t=(ulong)(time(NULL)-start);
 	if(tmsgs) {
 		if(t<1)
 			t=1;
diff --git a/src/sbbs3/upload.cpp b/src/sbbs3/upload.cpp
index 51339dd05e5260eba9152a812eecabc0e4b6fa5f..12bf28b771a31df74f88bc9503aee53e5768f4f4 100644
--- a/src/sbbs3/upload.cpp
+++ b/src/sbbs3/upload.cpp
@@ -195,7 +195,7 @@ bool sbbs_t::uploadfile(file_t *f)
 	if(cfg.dir[f->dir]->misc&DIR_AONLY)  /* Forced anonymous */
 		f->misc|=FM_ANON;
 	f->cdt=length;
-	f->dateuled=time(NULL);
+	f->dateuled=time32(NULL);
 	f->timesdled=0;
 	f->datedled=0L;
 	f->opencount=0;
@@ -425,7 +425,7 @@ bool sbbs_t::upload(uint dirnum)
 		now=time(NULL);
 		if(descbeg[0])
 			strcat(descbeg," ");
-		sprintf(str,"%s  ",unixtodstr(&cfg,now,tmp));
+		sprintf(str,"%s  ",unixtodstr(&cfg,(time32_t)now,tmp));
 		strcat(descbeg,str); 
 	}
 	if(cfg.dir[dirnum]->misc&DIR_MULT) {
diff --git a/src/sbbs3/userdat.c b/src/sbbs3/userdat.c
index 7166557bf8cbfc31013102662e4faba4c437d59f..e7602ab5372d8bd07b17b87782e7803fa2ad7c6d 100644
--- a/src/sbbs3/userdat.c
+++ b/src/sbbs3/userdat.c
@@ -359,7 +359,7 @@ int DLLCALL getuserdat(scfg_t* cfg, user_t *user)
 
 		now=time(NULL);
 		if(localtime_r(&now, &now_tm)!=NULL 
-			&& localtime_r(&user->logontime, &logon_tm)!=NULL) {
+			&& localtime32(&user->logontime, &logon_tm)!=NULL) {
 			if(now_tm.tm_year!=logon_tm.tm_year
 				|| now_tm.tm_mon!=logon_tm.tm_mon
 				|| now_tm.tm_mday!=logon_tm.tm_mday)
@@ -2576,7 +2576,7 @@ BOOL DLLCALL filter_ip(scfg_t* cfg, const char* prot, const char* reason, const
 	char	ip_can[MAX_PATH+1];
 	char	tstr[64];
     FILE*	fp;
-    time_t	now=time(NULL);
+    time32_t now=time32(NULL);
 
 	if(ip_addr==NULL)
 		return(FALSE);
@@ -2749,7 +2749,7 @@ ulong DLLCALL loginFailure(link_list_t* list, SOCKADDR_IN* addr, const char* pro
 			attempt->dupes++;
 	}
 	SAFECOPY(attempt->prot,prot);
-	attempt->time=time(NULL);
+	attempt->time=time32(NULL);
 	attempt->addr=addr->sin_addr;
 	SAFECOPY(attempt->user, user);
 	SAFECOPY(attempt->pass, pass);
diff --git a/src/sbbs3/userdat.h b/src/sbbs3/userdat.h
index 217cc1236df08f5b2b1dc124aaeb6eafb1cca6a3..eeb1ca612e3355180fc997f9dc9410f01df0f172 100644
--- a/src/sbbs3/userdat.h
+++ b/src/sbbs3/userdat.h
@@ -132,7 +132,7 @@ typedef struct {
 	IN_ADDR		addr;	/* host with consecutive failed login attmepts */
 	ulong		count;	/* number of consecutive failed login attempts */
 	ulong		dupes;	/* number of consecutive dupliate login attempts (same name and password) */
-	time_t		time;	/* time of last attempt */
+	time32_t	time;	/* time of last attempt */
 	char		prot[32];	/* protocol used in last attempt */
 	char		user[128];
 	char		pass[128];
diff --git a/src/sbbs3/useredit.cpp b/src/sbbs3/useredit.cpp
index db5811c7ad6b4ada150fae090f488c6b047d4535..7f05db9ccd176cd332bd04cf6c2ed12ac521d83c 100644
--- a/src/sbbs3/useredit.cpp
+++ b/src/sbbs3/useredit.cpp
@@ -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 2010 Rob Swindell - http://www.synchro.net/copyright.html		*
+ * Copyright 2011 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				*
@@ -93,7 +93,7 @@ void sbbs_t::useredit(int usernumber)
 				return; 
 			} 
 		}
-		unixtodstr(&cfg,time(NULL),str);
+		unixtodstr(&cfg,time32(NULL),str);
 		unixtodstr(&cfg,user.laston,tmp);
 		if(strcmp(str,tmp) && user.ltoday) {
 			user.ltoday=user.ttoday=user.ptoday=user.etoday=user.textra=0;
@@ -128,7 +128,7 @@ void sbbs_t::useredit(int usernumber)
 				,user.comment);
 		else
 			CRLF;
-		if(localtime_r(&user.laston,&tm)==NULL)
+		if(localtime32(&user.laston,&tm)==NULL)
 			return;
 		bprintf(text[UserDates]
 			,unixtodstr(&cfg,user.firston,str),unixtodstr(&cfg,user.expire,tmp)
@@ -371,28 +371,28 @@ void sbbs_t::useredit(int usernumber)
 				if(sys_status&SS_ABORT)
 					break;
 				user.laston=dstrtounix(&cfg,str);
-				putuserrec(&cfg,user.number,U_LASTON,8,ultoa(user.laston,tmp,16));
+				putuserrec(&cfg,user.number,U_LASTON,8,ultoa((ulong)user.laston,tmp,16));
 				bputs(text[UeditFirstOn]);
 				unixtodstr(&cfg,user.firston,str);
 				gettmplt(str,"nn/nn/nn",K_LINE|K_EDIT);
 				if(sys_status&SS_ABORT)
 					break;
 				user.firston=dstrtounix(&cfg,str);
-				putuserrec(&cfg,user.number,U_FIRSTON,8,ultoa(user.firston,tmp,16));
+				putuserrec(&cfg,user.number,U_FIRSTON,8,ultoa((ulong)user.firston,tmp,16));
 				bputs(text[UeditExpire]);
 				unixtodstr(&cfg,user.expire,str);
 				gettmplt(str,"nn/nn/nn",K_LINE|K_EDIT);
 				if(sys_status&SS_ABORT)
 					break;
 				user.expire=dstrtounix(&cfg,str);
-				putuserrec(&cfg,user.number,U_EXPIRE,8,ultoa(user.expire,tmp,16));
+				putuserrec(&cfg,user.number,U_EXPIRE,8,ultoa((ulong)user.expire,tmp,16));
 				bputs(text[UeditPwModDate]);
 				unixtodstr(&cfg,user.pwmod,str);
 				gettmplt(str,"nn/nn/nn",K_LINE|K_EDIT);
 				if(sys_status&SS_ABORT)
 					break;
 				user.pwmod=dstrtounix(&cfg,str);
-				putuserrec(&cfg,user.number,U_PWMOD,8,ultoa(user.pwmod,tmp,16));
+				putuserrec(&cfg,user.number,U_PWMOD,8,ultoa((ulong)user.pwmod,tmp,16));
 				break;
 			case 'L':
 				bputs(text[EnterYourAddress]);
@@ -503,7 +503,7 @@ void sbbs_t::useredit(int usernumber)
 				now=time(NULL);
 				if(cfg.val_expire[i]) {
 					if(user.expire<now)
-						user.expire=now+((long)cfg.val_expire[i]*24L*60L*60L);
+						user.expire=(time32_t)(now+((long)cfg.val_expire[i]*24L*60L*60L));
 					else
 						user.expire+=((long)cfg.val_expire[i]*24L*60L*60L); 
 				}
@@ -1036,7 +1036,7 @@ void sbbs_t::maindflts(user_t* user)
 						break;
 					putuserrec(&cfg,user->number,U_PASS,LEN_PASS,str);
 					now=time(NULL);
-					putuserrec(&cfg,user->number,U_PWMOD,8,ultoa(now,tmp,16));
+					putuserrec(&cfg,user->number,U_PWMOD,8,ultoa((ulong)now,tmp,16));
 					bputs(text[PasswordChanged]);
 					SAFEPRINTF(str,"%s changed password",useron.alias);
 					logline(LOG_NOTICE,nulstr,str);
diff --git a/src/sbbs3/websrvr.c b/src/sbbs3/websrvr.c
index f1cfb34640041960473c6be5f4205450861b871b..164c549c40637e95661c7421ecbd578e89318b61 100644
--- a/src/sbbs3/websrvr.c
+++ b/src/sbbs3/websrvr.c
@@ -102,8 +102,8 @@ static volatile ulong	sockets=0;
 static volatile BOOL	terminate_server=FALSE;
 static volatile BOOL	terminate_http_logging_thread=FALSE;
 static volatile	ulong	thread_count=0;
-static volatile SOCKET	server_socket=INVALID_SOCKET;
-static volatile SOCKET	server_socket6=INVALID_SOCKET;
+static SOCKET	server_socket=INVALID_SOCKET;
+static SOCKET	server_socket6=INVALID_SOCKET;
 static char		revision[16];
 static char		root_dir[MAX_PATH+1];
 static char		error_dir[MAX_PATH+1];
@@ -1379,7 +1379,7 @@ void http_logon(http_session_t * session, user_t *usr)
 		putuserrec(&scfg,session->user.number,U_MODEM,LEN_MODEM,"HTTP");
 		putuserrec(&scfg,session->user.number,U_COMP,LEN_COMP,session->host_name);
 		putuserrec(&scfg,session->user.number,U_NOTE,LEN_NOTE,session->host_ip);
-		putuserrec(&scfg,session->user.number,U_LOGONTIME,0,ultoa(session->logon_time,str,16));
+		putuserrec(&scfg,session->user.number,U_LOGONTIME,0,ultoa((ulong)session->logon_time,str,16));
 	}
 	session->client.user=session->username;
 	client_on(session->socket, &session->client, /* update existing client record? */TRUE);
@@ -5032,7 +5032,7 @@ void http_session_thread(void* arg)
 	SAFECOPY(session.client.addr,session.host_ip);
 	SAFECOPY(session.client.host,session.host_name);
 	session.client.port=ntohs(session.addr.sin_port);
-	session.client.time=time(NULL);
+	session.client.time=time32(NULL);
 	session.client.protocol="HTTP";
 	session.client.user=session.username;
 	session.client.size=sizeof(session.client);
diff --git a/src/sbbs3/writemsg.cpp b/src/sbbs3/writemsg.cpp
index 6e765ac40e8dac1b48d339323fe7ef98eb86bacd..256d11246c5e450c6d5c1aecc392b50c4042efa8 100644
--- a/src/sbbs3/writemsg.cpp
+++ b/src/sbbs3/writemsg.cpp
@@ -465,7 +465,7 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *title, long mode
 			removecase(msgtmp);
 		else {
 			qlen=(long)flength(msgtmp);
-			qtime=fdate(msgtmp); 
+			qtime=(long)fdate(msgtmp); 
 		}
 
 		CLS;
@@ -1154,7 +1154,7 @@ void sbbs_t::forwardmail(smbmsg_t *msg, int usernumber)
 	smb_hfield_str(msg,RECIPIENTEXT,str);
 	msg->idx.to=usernumber;
 
-	now32=time(NULL);
+	now32=time32(NULL);
 	smb_hfield(msg,FORWARDED,sizeof(time32_t),&now32);
 
 
diff --git a/src/sbbs3/xtrn_sec.cpp b/src/sbbs3/xtrn_sec.cpp
index 892f49c325142a12f9b76061cce0438ffd760578..f93a44630c83510d39a8a3f7c7e31b613e76e383 100644
--- a/src/sbbs3/xtrn_sec.cpp
+++ b/src/sbbs3/xtrn_sec.cpp
@@ -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 2010 Rob Swindell - http://www.synchro.net/copyright.html		*
+ * Copyright 2011 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				*
@@ -625,7 +625,7 @@ void sbbs_t::xtrndat(char *name, char *dropdir, uchar type, ulong tleft
 		write(file,str,strlen(str));
 
 		localtime_r(&logontime,&tm);
-		localtime_r(&useron.laston,&tl);
+		localtime32(&useron.laston,&tl);
 		sprintf(str,"%02d:%02d\n%02d:%02d\n%u\n%u\n%lu\n"
 			"%lu\n%s\n%u\n%u\n"
 			,tm.tm_hour							/* 44: Time of this call */
@@ -725,7 +725,7 @@ void sbbs_t::xtrndat(char *name, char *dropdir, uchar type, ulong tleft
 		str2pas(useron.phone,str);
 		write(file,str,13); 					/* DataPhone */
 		write(file,str,13); 					/* HomePhone */
-		localtime_r(&useron.laston,&tm);
+		localtime32(&useron.laston,&tm);
 		sprintf(tmp,"%02d:%02d",tm.tm_hour,tm.tm_min);
 		str2pas(tmp,str);
 		write(file,str,6);						/* LastTime */
@@ -790,7 +790,7 @@ void sbbs_t::xtrndat(char *name, char *dropdir, uchar type, ulong tleft
 		sprintf(tmp,"%02d:%02d",tm.tm_hour,tm.tm_min);
 		str2pas(tmp,str);
 		write(file,str,6);						/* LoginTime */
-		unixtodstr(&cfg,logontime,tmp);
+		unixtodstr(&cfg,(time32_t)logontime,tmp);
 		str2pas(tmp,str);
 		write(file,str,9);						/* LoginDate */
 		write(file,&cfg.level_timepercall[useron.level],sizeof(int16_t));  /* TmLimit */
@@ -887,7 +887,7 @@ void sbbs_t::xtrndat(char *name, char *dropdir, uchar type, ulong tleft
 		lfexpand(str,misc);
 		write(file,str,strlen(str));
 
-		localtime_r(&useron.laston,&tm);
+		localtime32(&useron.laston,&tm);
 		sprintf(str,"%u\n%u\n%u\n%u\n%s\n%s %02u:%02u\n"
 			,0									/* Daily download total */
 			,0									/* Max download files */
@@ -982,7 +982,7 @@ void sbbs_t::xtrndat(char *name, char *dropdir, uchar type, ulong tleft
 		write(file,&i,2);						/* Logon time in min since mid */
 
 		now=time(NULL);
-		i=-(((now-starttime)/60)+useron.ttoday);/* Negative minutes used */
+		i=-(int16_t)(((now-starttime)/60)+(time_t)useron.ttoday);/* Negative minutes used */
 		write(file,&i,2);
 
 		sprintf(str,"%02d:%02d",tm.tm_hour,tm.tm_min);
@@ -1084,7 +1084,7 @@ void sbbs_t::xtrndat(char *name, char *dropdir, uchar type, ulong tleft
 		write(file,useron.phone,14);	/* Home or Voice Phone */
 		i=unixtojulian(useron.laston);
 		write(file,&i,2);				/* Date last on */
-		localtime_r(&useron.laston,&tm);
+		localtime32(&useron.laston,&tm);
 		sprintf(str,"%02d:%02d",tm.tm_hour,tm.tm_min);
 		write(file,str,6);				/* Last time on */
 		if(useron.misc&EXPERT)
@@ -1112,7 +1112,7 @@ void sbbs_t::xtrndat(char *name, char *dropdir, uchar type, ulong tleft
 		write(file,&l,4);				/* Number of download bytes today */
 		write(file,&useron.note,31);	/* Comment #1 */
 		write(file,&useron.comp,31);	/* Comment #2 */
-		i=(now-starttime)/60;
+		i=(int16_t)(now-starttime)/60;
 		write(file,&i,2);				/* Minutes online (this logon?) */
 		i=unixtojulian(useron.expire);
 		write(file,&i,2);				/* Expiration date */
@@ -1402,8 +1402,8 @@ void sbbs_t::moduserdat(uint xtrnnum)
 				&& isdigit(str[3]) && isdigit(str[4])
 				&& (str[5]=='/' || str[5]=='-')
 				&& isdigit(str[6]) && isdigit(str[7])) { /* valid expire date */
-				useron.expire=dstrtounix(&cfg,str);
-				putuserrec(&cfg,useron.number,U_EXPIRE,8,ultoa(useron.expire,tmp,16)); 
+				useron.expire=(ulong)dstrtounix(&cfg,str);
+				putuserrec(&cfg,useron.number,U_EXPIRE,8,ultoa((ulong)useron.expire,tmp,16)); 
 			}
 
 			for(;i<29;i++)					/* line 29, total downloaded files */
@@ -1454,8 +1454,8 @@ void sbbs_t::moduserdat(uint xtrnnum)
 				}
 				lseek(file,75,SEEK_CUR);	/* read in expiration date */
 				read(file,&i,2);			/* convert from julian to unix */
-				useron.expire=juliantounix(i);
-				putuserrec(&cfg,useron.number,U_EXPIRE,8,ultoa(useron.expire,tmp,16)); 
+				useron.expire=(ulong)juliantounix(i);
+				putuserrec(&cfg,useron.number,U_EXPIRE,8,ultoa((ulong)useron.expire,tmp,16)); 
 			}
 			close(file); 
 		}