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)
if(!strcmp(sp,"TIME") || !strcmp(sp,"SYSTIME")) {
now=time(NULL);
tm_p=gmtime(&now);
tm_p=localtime(&now);
if(tm_p!=NULL)
tm=*tm_p;
else
......@@ -421,7 +421,7 @@ char* sbbs_t::atcode(char* sp, char* str)
return(unixtodstr(&cfg,useron.laston,str));
if(!strcmp(sp,"LASTTIMEON")) {
tm_p=gmtime(&useron.laston);
tm_p=localtime(&useron.laston);
if(tm_p)
tm=*tm_p;
else
......
......@@ -454,7 +454,7 @@ void sbbs_t::start_batch_download()
t=now;
if(cur_cps)
t+=(totalsize/(ulong)cur_cps);
tm=gmtime(&t);
tm=localtime(&t);
if(tm==NULL)
return;
thisnode.aux=(tm->tm_hour*60)+tm->tm_min;
......
......@@ -1381,7 +1381,7 @@ void sbbs_t::guruchat(char *line, char *gurubuf, int gurunum)
struct tm tm;
now=time(NULL);
tm_p=gmtime(&now);
tm_p=localtime(&now);
if(tm_p)
tm=*tm_p;
else
......
......@@ -379,7 +379,7 @@ bool sbbs_t::ar_exp(uchar **ptrptr, user_t* user)
break;
case AR_TIME:
now=time(NULL);
tm=gmtime(&now);
tm=localtime(&now);
if(tm==NULL || (tm->tm_hour*60)+tm->tm_min<(int)i)
result=_not;
else
......
......@@ -328,7 +328,7 @@ void sbbs_t::ctrl_a(char x)
break;
case 'T': /* Time */
now=time(NULL);
tm=gmtime(&now);
tm=localtime(&now);
if(tm!=NULL)
bprintf("%02d:%02d %s"
,tm->tm_hour==0 ? 12
......
......@@ -202,12 +202,12 @@ void sbbs_t::gettimeleft(void)
|| !(cfg.event[i]->days&(1<<tm->tm_wday)))
continue;
tm=gmtime(&cfg.event[i]->last);
tm=localtime(&cfg.event[i]->last);
if(tm)
last_tm=*tm;
else
memset(&last_tm,0,sizeof(last_tm));
tm=gmtime(&now);
tm=localtime(&now);
if(tm==NULL)
return;
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)
if(!unix_time)
strcpy(str,"00/00/00");
else {
tm=gmtime(&unix_time);
tm=localtime(&unix_time);
if(tm==NULL) {
strcpy(str,"00/00/00");
return(str);
......
......@@ -237,7 +237,7 @@ int sbbs_t::exec_function(csi_t *csi)
case CS_SYSTEM_LOG: /* System log */
if(!chksyspass())
return(0);
tm=gmtime(&now);
tm=localtime(&now);
if(tm==NULL)
return(0);
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)
if(!chksyspass())
return(0);
now-=(ulong)60L*24L*60L;
tm=gmtime(&now);
tm=localtime(&now);
if(tm==NULL)
return(0);
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)
lp=getintvar(csi,*(long *)csi->ip);
csi->ip+=4;
if(pp && lp) {
tm_p=gmtime(lp);
tm_p=localtime(lp);
if(tm_p) {
strftime(buf,128,str,tm_p);
*pp=copystrvar(csi,*pp,buf); } }
......
......@@ -169,7 +169,7 @@ bool sbbs_t::netmail(char *into, char *title, long mode)
}
now=time(NULL);
tm=gmtime(&now);
tm=localtime(&now);
if(tm!=NULL)
sprintf(hdr.time,"%02u %3.3s %02u %02u:%02u:%02u"
,tm->tm_mday,mon[tm->tm_mon],TM_YEAR(tm->tm_year)
......
......@@ -3064,7 +3064,7 @@ static void ctrl_thread(void* arg)
}
if(!strnicmp(cmd,"MDTM ",5)) {
t=fdate(fname);
tm_p=gmtime(&t);
tm_p=gmtime(&t); /* specifically use GMT/UTC representation */
if(tm_p==NULL)
memset(&tm,0,sizeof(tm));
else
......@@ -3829,7 +3829,7 @@ static void ctrl_thread(void* arg)
sockprintf(sock,"213 %lu",flength(fname));
else if(getdate && success) {
t=fdate(fname);
tm_p=gmtime(&t);
tm_p=gmtime(&t); /* specifically use GMT/UTC representation */
if(tm_p==NULL)
memset(&tm,0,sizeof(tm));
else
......
......@@ -574,7 +574,7 @@ js_strftime(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
t=JSVAL_TO_INT(argv[1]);
strcpy(str,"-Invalid time-");
tm_p=gmtime(&t);
tm_p=localtime(&t);
if(tm_p)
strftime(str,sizeof(str),fmt,tm_p);
......
......@@ -1281,7 +1281,7 @@ int sbbs_t::listfileinfo(uint dirnum, char *filespec, long mode)
getnodedat(cfg.node_num,&thisnode,1);
action=NODE_DLNG;
t=now+f.timetodl;
tm=gmtime(&t);
tm=localtime(&t);
if(tm==NULL)
break;
thisnode.aux=(tm->tm_hour*60)+tm->tm_min;
......
......@@ -139,7 +139,7 @@ bool sbbs_t::syslog(char* code, char *entry)
struct tm * tm;
now=time(NULL);
tm=gmtime(&now);
tm=localtime(&now);
if(tm==NULL)
return(false);
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()
close(dsts);
if(update_t>now+(24L*60L*60L)) /* More than a day in the future? */
errormsg(WHERE,ERR_CHK,"Daily stats time stamp",update_t);
tm = gmtime(&update_t);
tm = localtime(&update_t);
if(tm==NULL)
return(0);
update_tm=*tm;
tm = gmtime(&now);
tm = localtime(&now);
if(tm==NULL)
return(0);
if((tm->tm_mday>update_tm.tm_mday && tm->tm_mon==update_tm.tm_mon)
......
......@@ -51,7 +51,7 @@ void sbbs_t::logout()
struct tm * tm, tm_now;
now=time(NULL);
tm=gmtime(&now);
tm=localtime(&now);
if(tm==NULL)
return;
tm_now=*tm;
......@@ -232,11 +232,11 @@ void sbbs_t::logofflist()
int file;
struct tm * tm, tm_now;
tm=gmtime(&now);
tm=localtime(&now);
if(tm==NULL)
return;
tm_now=*tm;
tm=gmtime(&logontime);
tm=localtime(&logontime);
if(tm==NULL)
return;
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)
while(!sbbs->terminated && telnet_socket!=INVALID_SOCKET) {
now=time(NULL);
now_tm=*gmtime(&now);
now_tm=*localtime(&now);
if(now-lastsemchk>=sbbs->cfg.node_sem_check) {
check_semaphores=true;
......@@ -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 */
|| ((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)
if(sbbs->cfg.phub[i]->node<first_node
|| sbbs->cfg.phub[i]->node>last_node)
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
|| (((sbbs->cfg.phub[i]->freq /* or frequency */
&& (now-sbbs->cfg.phub[i]->last)/60>sbbs->cfg.phub[i]->freq)
......@@ -1384,7 +1384,7 @@ void event_thread(void* arg)
for(i=0;i<sbbs->cfg.total_events;i++) {
if(!sbbs->cfg.event[i]->node || sbbs->cfg.event[i]->node>sbbs->cfg.sys_nodes)
continue;
tm=gmtime(&sbbs->cfg.event[i]->last);
tm=localtime(&sbbs->cfg.event[i]->last);
if(tm==NULL || sbbs->cfg.event[i]->last==-1 ||
(((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)
return;
}
now=time(NULL);
tm=gmtime(&now);
tm=localtime(&now);
if(tm==NULL)
return;
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
size++;
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)
tm=*tm_p;
else
......
......@@ -108,7 +108,7 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
return(false); }
now=time(NULL);
tm=gmtime(&now);
tm=localtime(&now);
if(tm==NULL)
return(false);
......
......@@ -97,7 +97,7 @@ char * unixtodstr(time_t unix, char *str)
if(!unix)
strcpy(str,"00/00/00");
else {
tm=gmtime(&unix);
tm=localtime(&unix);
if(tm==NULL) {
strcpy(str,"00/00/00");
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