Commit 5fd9ec05 authored by rswindell's avatar rswindell
Browse files

Changed use of gmtime() to localtime() for systems using localtime rather than

GMT/UTC.
parent aa488a96
...@@ -204,7 +204,7 @@ char* sbbs_t::atcode(char* sp, char* str) ...@@ -204,7 +204,7 @@ char* sbbs_t::atcode(char* sp, char* str)
if(!strcmp(sp,"TIME") || !strcmp(sp,"SYSTIME")) { if(!strcmp(sp,"TIME") || !strcmp(sp,"SYSTIME")) {
now=time(NULL); now=time(NULL);
tm_p=gmtime(&now); tm_p=localtime(&now);
if(tm_p!=NULL) if(tm_p!=NULL)
tm=*tm_p; tm=*tm_p;
else else
...@@ -421,7 +421,7 @@ char* sbbs_t::atcode(char* sp, char* str) ...@@ -421,7 +421,7 @@ char* sbbs_t::atcode(char* sp, char* str)
return(unixtodstr(&cfg,useron.laston,str)); return(unixtodstr(&cfg,useron.laston,str));
if(!strcmp(sp,"LASTTIMEON")) { if(!strcmp(sp,"LASTTIMEON")) {
tm_p=gmtime(&useron.laston); tm_p=localtime(&useron.laston);
if(tm_p) if(tm_p)
tm=*tm_p; tm=*tm_p;
else else
......
...@@ -454,7 +454,7 @@ void sbbs_t::start_batch_download() ...@@ -454,7 +454,7 @@ void sbbs_t::start_batch_download()
t=now; t=now;
if(cur_cps) if(cur_cps)
t+=(totalsize/(ulong)cur_cps); t+=(totalsize/(ulong)cur_cps);
tm=gmtime(&t); tm=localtime(&t);
if(tm==NULL) if(tm==NULL)
return; return;
thisnode.aux=(tm->tm_hour*60)+tm->tm_min; thisnode.aux=(tm->tm_hour*60)+tm->tm_min;
......
...@@ -1381,7 +1381,7 @@ void sbbs_t::guruchat(char *line, char *gurubuf, int gurunum) ...@@ -1381,7 +1381,7 @@ void sbbs_t::guruchat(char *line, char *gurubuf, int gurunum)
struct tm tm; struct tm tm;
now=time(NULL); now=time(NULL);
tm_p=gmtime(&now); tm_p=localtime(&now);
if(tm_p) if(tm_p)
tm=*tm_p; tm=*tm_p;
else else
......
...@@ -379,7 +379,7 @@ bool sbbs_t::ar_exp(uchar **ptrptr, user_t* user) ...@@ -379,7 +379,7 @@ bool sbbs_t::ar_exp(uchar **ptrptr, user_t* user)
break; break;
case AR_TIME: case AR_TIME:
now=time(NULL); now=time(NULL);
tm=gmtime(&now); tm=localtime(&now);
if(tm==NULL || (tm->tm_hour*60)+tm->tm_min<(int)i) if(tm==NULL || (tm->tm_hour*60)+tm->tm_min<(int)i)
result=_not; result=_not;
else else
......
...@@ -328,7 +328,7 @@ void sbbs_t::ctrl_a(char x) ...@@ -328,7 +328,7 @@ void sbbs_t::ctrl_a(char x)
break; break;
case 'T': /* Time */ case 'T': /* Time */
now=time(NULL); now=time(NULL);
tm=gmtime(&now); tm=localtime(&now);
if(tm!=NULL) if(tm!=NULL)
bprintf("%02d:%02d %s" bprintf("%02d:%02d %s"
,tm->tm_hour==0 ? 12 ,tm->tm_hour==0 ? 12
......
...@@ -202,12 +202,12 @@ void sbbs_t::gettimeleft(void) ...@@ -202,12 +202,12 @@ void sbbs_t::gettimeleft(void)
|| !(cfg.event[i]->days&(1<<tm->tm_wday))) || !(cfg.event[i]->days&(1<<tm->tm_wday)))
continue; continue;
tm=gmtime(&cfg.event[i]->last); tm=localtime(&cfg.event[i]->last);
if(tm) if(tm)
last_tm=*tm; last_tm=*tm;
else else
memset(&last_tm,0,sizeof(last_tm)); memset(&last_tm,0,sizeof(last_tm));
tm=gmtime(&now); tm=localtime(&now);
if(tm==NULL) if(tm==NULL)
return; return;
tm->tm_hour=cfg.event[i]->time/60; /* hasn't run yet today */ tm->tm_hour=cfg.event[i]->time/60; /* hasn't run yet today */
......
...@@ -95,7 +95,7 @@ char* DLLCALL unixtodstr(scfg_t* cfg, time_t unix_time, char *str) ...@@ -95,7 +95,7 @@ char* DLLCALL unixtodstr(scfg_t* cfg, time_t unix_time, char *str)
if(!unix_time) if(!unix_time)
strcpy(str,"00/00/00"); strcpy(str,"00/00/00");
else { else {
tm=gmtime(&unix_time); tm=localtime(&unix_time);
if(tm==NULL) { if(tm==NULL) {
strcpy(str,"00/00/00"); strcpy(str,"00/00/00");
return(str); return(str);
......
...@@ -237,7 +237,7 @@ int sbbs_t::exec_function(csi_t *csi) ...@@ -237,7 +237,7 @@ int sbbs_t::exec_function(csi_t *csi)
case CS_SYSTEM_LOG: /* System log */ case CS_SYSTEM_LOG: /* System log */
if(!chksyspass()) if(!chksyspass())
return(0); return(0);
tm=gmtime(&now); tm=localtime(&now);
if(tm==NULL) if(tm==NULL)
return(0); return(0);
sprintf(str,"%slogs/%2.2d%2.2d%2.2d.log", cfg.data_dir sprintf(str,"%slogs/%2.2d%2.2d%2.2d.log", cfg.data_dir
...@@ -248,7 +248,7 @@ int sbbs_t::exec_function(csi_t *csi) ...@@ -248,7 +248,7 @@ int sbbs_t::exec_function(csi_t *csi)
if(!chksyspass()) if(!chksyspass())
return(0); return(0);
now-=(ulong)60L*24L*60L; now-=(ulong)60L*24L*60L;
tm=gmtime(&now); tm=localtime(&now);
if(tm==NULL) if(tm==NULL)
return(0); return(0);
sprintf(str,"%slogs/%2.2d%2.2d%2.2d.log",cfg.data_dir sprintf(str,"%slogs/%2.2d%2.2d%2.2d.log",cfg.data_dir
......
...@@ -516,7 +516,7 @@ int sbbs_t::exec_misc(csi_t* csi, char *path) ...@@ -516,7 +516,7 @@ int sbbs_t::exec_misc(csi_t* csi, char *path)
lp=getintvar(csi,*(long *)csi->ip); lp=getintvar(csi,*(long *)csi->ip);
csi->ip+=4; csi->ip+=4;
if(pp && lp) { if(pp && lp) {
tm_p=gmtime(lp); tm_p=localtime(lp);
if(tm_p) { if(tm_p) {
strftime(buf,128,str,tm_p); strftime(buf,128,str,tm_p);
*pp=copystrvar(csi,*pp,buf); } } *pp=copystrvar(csi,*pp,buf); } }
......
...@@ -169,7 +169,7 @@ bool sbbs_t::netmail(char *into, char *title, long mode) ...@@ -169,7 +169,7 @@ bool sbbs_t::netmail(char *into, char *title, long mode)
} }
now=time(NULL); now=time(NULL);
tm=gmtime(&now); tm=localtime(&now);
if(tm!=NULL) if(tm!=NULL)
sprintf(hdr.time,"%02u %3.3s %02u %02u:%02u:%02u" sprintf(hdr.time,"%02u %3.3s %02u %02u:%02u:%02u"
,tm->tm_mday,mon[tm->tm_mon],TM_YEAR(tm->tm_year) ,tm->tm_mday,mon[tm->tm_mon],TM_YEAR(tm->tm_year)
......
...@@ -3064,7 +3064,7 @@ static void ctrl_thread(void* arg) ...@@ -3064,7 +3064,7 @@ static void ctrl_thread(void* arg)
} }
if(!strnicmp(cmd,"MDTM ",5)) { if(!strnicmp(cmd,"MDTM ",5)) {
t=fdate(fname); t=fdate(fname);
tm_p=gmtime(&t); tm_p=gmtime(&t); /* specifically use GMT/UTC representation */
if(tm_p==NULL) if(tm_p==NULL)
memset(&tm,0,sizeof(tm)); memset(&tm,0,sizeof(tm));
else else
...@@ -3829,7 +3829,7 @@ static void ctrl_thread(void* arg) ...@@ -3829,7 +3829,7 @@ static void ctrl_thread(void* arg)
sockprintf(sock,"213 %lu",flength(fname)); sockprintf(sock,"213 %lu",flength(fname));
else if(getdate && success) { else if(getdate && success) {
t=fdate(fname); t=fdate(fname);
tm_p=gmtime(&t); tm_p=gmtime(&t); /* specifically use GMT/UTC representation */
if(tm_p==NULL) if(tm_p==NULL)
memset(&tm,0,sizeof(tm)); memset(&tm,0,sizeof(tm));
else else
......
...@@ -574,7 +574,7 @@ js_strftime(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) ...@@ -574,7 +574,7 @@ js_strftime(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
t=JSVAL_TO_INT(argv[1]); t=JSVAL_TO_INT(argv[1]);
strcpy(str,"-Invalid time-"); strcpy(str,"-Invalid time-");
tm_p=gmtime(&t); tm_p=localtime(&t);
if(tm_p) if(tm_p)
strftime(str,sizeof(str),fmt,tm_p); strftime(str,sizeof(str),fmt,tm_p);
......
...@@ -1281,7 +1281,7 @@ int sbbs_t::listfileinfo(uint dirnum, char *filespec, long mode) ...@@ -1281,7 +1281,7 @@ int sbbs_t::listfileinfo(uint dirnum, char *filespec, long mode)
getnodedat(cfg.node_num,&thisnode,1); getnodedat(cfg.node_num,&thisnode,1);
action=NODE_DLNG; action=NODE_DLNG;
t=now+f.timetodl; t=now+f.timetodl;
tm=gmtime(&t); tm=localtime(&t);
if(tm==NULL) if(tm==NULL)
break; break;
thisnode.aux=(tm->tm_hour*60)+tm->tm_min; thisnode.aux=(tm->tm_hour*60)+tm->tm_min;
......
...@@ -139,7 +139,7 @@ bool sbbs_t::syslog(char* code, char *entry) ...@@ -139,7 +139,7 @@ bool sbbs_t::syslog(char* code, char *entry)
struct tm * tm; struct tm * tm;
now=time(NULL); now=time(NULL);
tm=gmtime(&now); tm=localtime(&now);
if(tm==NULL) if(tm==NULL)
return(false); return(false);
sprintf(fname,"%slogs/%2.2d%2.2d%2.2d.log",cfg.data_dir,tm->tm_mon+1,tm->tm_mday sprintf(fname,"%slogs/%2.2d%2.2d%2.2d.log",cfg.data_dir,tm->tm_mon+1,tm->tm_mday
......
...@@ -539,11 +539,11 @@ ulong sbbs_t::logonstats() ...@@ -539,11 +539,11 @@ ulong sbbs_t::logonstats()
close(dsts); close(dsts);
if(update_t>now+(24L*60L*60L)) /* More than a day in the future? */ 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",update_t);
tm = gmtime(&update_t); tm = localtime(&update_t);
if(tm==NULL) if(tm==NULL)
return(0); return(0);
update_tm=*tm; update_tm=*tm;
tm = gmtime(&now); tm = localtime(&now);
if(tm==NULL) if(tm==NULL)
return(0); return(0);
if((tm->tm_mday>update_tm.tm_mday && tm->tm_mon==update_tm.tm_mon) if((tm->tm_mday>update_tm.tm_mday && tm->tm_mon==update_tm.tm_mon)
......
...@@ -51,7 +51,7 @@ void sbbs_t::logout() ...@@ -51,7 +51,7 @@ void sbbs_t::logout()
struct tm * tm, tm_now; struct tm * tm, tm_now;
now=time(NULL); now=time(NULL);
tm=gmtime(&now); tm=localtime(&now);
if(tm==NULL) if(tm==NULL)
return; return;
tm_now=*tm; tm_now=*tm;
...@@ -232,11 +232,11 @@ void sbbs_t::logofflist() ...@@ -232,11 +232,11 @@ void sbbs_t::logofflist()
int file; int file;
struct tm * tm, tm_now; struct tm * tm, tm_now;
tm=gmtime(&now); tm=localtime(&now);
if(tm==NULL) if(tm==NULL)
return; return;
tm_now=*tm; tm_now=*tm;
tm=gmtime(&logontime); tm=localtime(&logontime);
if(tm==NULL) if(tm==NULL)
return; return;
sprintf(str,"%slogs/%2.2d%2.2d%2.2d.LOL",cfg.data_dir,tm->tm_mon+1,tm->tm_mday sprintf(str,"%slogs/%2.2d%2.2d%2.2d.LOL",cfg.data_dir,tm->tm_mon+1,tm->tm_mday
......
...@@ -1002,7 +1002,7 @@ void event_thread(void* arg) ...@@ -1002,7 +1002,7 @@ void event_thread(void* arg)
while(!sbbs->terminated && telnet_socket!=INVALID_SOCKET) { while(!sbbs->terminated && telnet_socket!=INVALID_SOCKET) {
now=time(NULL); now=time(NULL);
now_tm=*gmtime(&now); now_tm=*localtime(&now);
if(now-lastsemchk>=sbbs->cfg.node_sem_check) { if(now-lastsemchk>=sbbs->cfg.node_sem_check) {
check_semaphores=true; check_semaphores=true;
...@@ -1270,7 +1270,7 @@ void event_thread(void* arg) ...@@ -1270,7 +1270,7 @@ void event_thread(void* arg)
} }
} }
tm=gmtime(&sbbs->cfg.qhub[i]->last); /* Qnet call out based on time */ tm=localtime(&sbbs->cfg.qhub[i]->last); /* Qnet call out based on time */
if((tm==NULL || sbbs->cfg.qhub[i]->last==-1L /* or frequency */ if((tm==NULL || sbbs->cfg.qhub[i]->last==-1L /* or frequency */
|| ((sbbs->cfg.qhub[i]->freq || ((sbbs->cfg.qhub[i]->freq
&& (now-sbbs->cfg.qhub[i]->last)/60>sbbs->cfg.qhub[i]->freq) && (now-sbbs->cfg.qhub[i]->last)/60>sbbs->cfg.qhub[i]->freq)
...@@ -1342,7 +1342,7 @@ void event_thread(void* arg) ...@@ -1342,7 +1342,7 @@ void event_thread(void* arg)
if(sbbs->cfg.phub[i]->node<first_node if(sbbs->cfg.phub[i]->node<first_node
|| sbbs->cfg.phub[i]->node>last_node) || sbbs->cfg.phub[i]->node>last_node)
continue; continue;
tm=gmtime(&sbbs->cfg.phub[i]->last); /* PostLink call out based on time */ tm=localtime(&sbbs->cfg.phub[i]->last); /* PostLink call out based on time */
if(tm==NULL || sbbs->cfg.phub[i]->last==-1 if(tm==NULL || sbbs->cfg.phub[i]->last==-1
|| (((sbbs->cfg.phub[i]->freq /* or frequency */ || (((sbbs->cfg.phub[i]->freq /* or frequency */
&& (now-sbbs->cfg.phub[i]->last)/60>sbbs->cfg.phub[i]->freq) && (now-sbbs->cfg.phub[i]->last)/60>sbbs->cfg.phub[i]->freq)
...@@ -1384,7 +1384,7 @@ void event_thread(void* arg) ...@@ -1384,7 +1384,7 @@ void event_thread(void* arg)
for(i=0;i<sbbs->cfg.total_events;i++) { for(i=0;i<sbbs->cfg.total_events;i++) {
if(!sbbs->cfg.event[i]->node || sbbs->cfg.event[i]->node>sbbs->cfg.sys_nodes) if(!sbbs->cfg.event[i]->node || sbbs->cfg.event[i]->node>sbbs->cfg.sys_nodes)
continue; continue;
tm=gmtime(&sbbs->cfg.event[i]->last); tm=localtime(&sbbs->cfg.event[i]->last);
if(tm==NULL || sbbs->cfg.event[i]->last==-1 || if(tm==NULL || sbbs->cfg.event[i]->last==-1 ||
(((sbbs->cfg.event[i]->freq (((sbbs->cfg.event[i]->freq
&& (now-sbbs->cfg.event[i]->last)/60>sbbs->cfg.event[i]->freq) && (now-sbbs->cfg.event[i]->last)/60>sbbs->cfg.event[i]->freq)
...@@ -2506,7 +2506,7 @@ void sbbs_t::catsyslog(int crash) ...@@ -2506,7 +2506,7 @@ void sbbs_t::catsyslog(int crash)
return; return;
} }
now=time(NULL); now=time(NULL);
tm=gmtime(&now); tm=localtime(&now);
if(tm==NULL) if(tm==NULL)
return; return;
sprintf(str,"%slogs/%2.2d%2.2d%2.2d.log",cfg.data_dir,tm->tm_mon+1,tm->tm_mday sprintf(str,"%slogs/%2.2d%2.2d%2.2d.log",cfg.data_dir,tm->tm_mon+1,tm->tm_mday
......
...@@ -290,7 +290,7 @@ ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, int subnum ...@@ -290,7 +290,7 @@ ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, int subnum
size++; size++;
fputc(SP,qwk_fp); } fputc(SP,qwk_fp); }
tm_p=gmtime((time_t *)&msg->hdr.when_written.time); tm_p=localtime((time_t *)&msg->hdr.when_written.time);
if(tm_p) if(tm_p)
tm=*tm_p; tm=*tm_p;
else else
......
...@@ -108,7 +108,7 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack) ...@@ -108,7 +108,7 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
return(false); } return(false); }
now=time(NULL); now=time(NULL);
tm=gmtime(&now); tm=localtime(&now);
if(tm==NULL) if(tm==NULL)
return(false); return(false);
......
...@@ -97,7 +97,7 @@ char * unixtodstr(time_t unix, char *str) ...@@ -97,7 +97,7 @@ char * unixtodstr(time_t unix, char *str)
if(!unix) if(!unix)
strcpy(str,"00/00/00"); strcpy(str,"00/00/00");
else { else {
tm=gmtime(&unix); tm=localtime(&unix);
if(tm==NULL) { if(tm==NULL) {
strcpy(str,"00/00/00"); strcpy(str,"00/00/00");
return(str); return(str);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment