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
......@@ -397,7 +397,7 @@ do {
sprintf(hdr.from,"SBBSecho");
t=time(NULL);
tm=gmtime(&t);
tm=localtime(&t);
sprintf(hdr.time,"%02u %3.3s %02u %02u:%02u:%02u"
,tm->tm_mday,mon[tm->tm_mon],TM_YEAR(tm->tm_year)
,tm->tm_hour,tm->tm_min,tm->tm_sec);
......@@ -2616,7 +2616,7 @@ char *pktname(void)
now=time(NULL);
for(i=0;i<MAX_TOTAL_PKTS*2;i++) {
now+=i;
tm=gmtime(&now);
tm=localtime(&now);
sprintf(str,"%s%02u%02u%02u%02u.PK_",cfg.outbound,tm->tm_mday,tm->tm_hour
,tm->tm_min,tm->tm_sec);
if(!fexist(str)) /* Add 1 second if name exists */
......@@ -3120,7 +3120,7 @@ for(j=0;j<area.uplinks;j++) {
break; } }
strcpy(outpkt[i].filename,pktname());
now=time(NULL);
tm=gmtime(&now);
tm=localtime(&now);
if((outpkt[i].stream=fnopen(&file,outpkt[i].filename
,O_WRONLY|O_CREAT))==NULL) {
printf("Unable to open %s for write.\n"
......@@ -3607,7 +3607,7 @@ void export_echomail(char *sub_code,faddr_t addr)
sprintf(hdr.from,"%.35s",msg.from);
tm=gmtime((time_t *)&msg.hdr.when_written.time);
tm=localtime((time_t *)&msg.hdr.when_written.time);
sprintf(hdr.time,"%02u %3.3s %02u %02u:%02u:%02u"
,tm->tm_mday,mon[tm->tm_mon],TM_YEAR(tm->tm_year)
,tm->tm_hour,tm->tm_min,tm->tm_sec);
......@@ -4685,7 +4685,7 @@ for(f=0;f<g.gl_pathc && !kbhit();f++) {
strcpy(packet,pktname());
now=time(NULL);
tm=gmtime(&now);
tm=localtime(&now);
if((stream=fnopen(&file,packet,O_WRONLY|O_APPEND|O_CREAT))==NULL) {
printf("Unable to open %s for write.\n"
,packet);
......
......@@ -529,7 +529,7 @@ bool sbbs_t::inputnstime(time_t *dt)
bputs(text[NScanDate]);
bputs(timestr(dt));
CRLF;
tp=gmtime(dt);
tp=localtime(dt);
if(tp==NULL) {
errormsg(WHERE,ERR_CHK,"time ptr",0);
return(FALSE);
......@@ -889,7 +889,7 @@ void sbbs_t::user_info()
bprintf(text[UserStats],useron.alias,useron.number);
tm=gmtime(&useron.laston);
tm=localtime(&useron.laston);
if(tm!=NULL)
bprintf(text[UserDates]
,unixtodstr(&cfg,useron.firston,str)
......
......@@ -170,7 +170,7 @@ void sbbs_t::temp_xfer()
t=now;
if(cur_cps)
t+=(f.size/(ulong)cur_cps);
tm=gmtime(&t);
tm=localtime(&t);
if(tm==NULL)
break;
thisnode.aux=(tm->tm_hour*60)+tm->tm_min;
......
......@@ -607,7 +607,7 @@ char DLLCALL getage(scfg_t* cfg, char *birth)
return(0);
now=time(NULL);
tm=gmtime(&now);
tm=localtime(&now);
if(tm==NULL)
return(0);
age=(tm->tm_year)-(((birth[6]&0xf)*10)+(birth[7]&0xf));
......@@ -1046,7 +1046,7 @@ static BOOL ar_exp(scfg_t* cfg, 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
......@@ -1375,12 +1375,12 @@ BOOL DLLCALL logoutuserdat(scfg_t* cfg, user_t* user, time_t now, time_t logonti
adjustuserrec(cfg,user->number,U_TTODAY,5,user->tlast);
/* Convert time_t to struct tm */
tm=gmtime(&now);
tm=localtime(&now);
if(tm==NULL)
return(FALSE);
tm_now=*tm;
tm=gmtime(&logontime);
tm=localtime(&logontime);
if(tm==NULL)
return(FALSE);
......
......@@ -121,7 +121,7 @@ void sbbs_t::useredit(int usernumber)
,user.comment);
else
CRLF;
tm=gmtime(&user.laston);
tm=localtime(&user.laston);
if(tm==NULL)
return;
bprintf(text[UserDates]
......
......@@ -284,7 +284,7 @@ int sbbs_t::external(char* cmdline, long mode, char* startup_dir)
strcpy(realcmdline, fullcmdline); // for errormsg if failed to execute
now=time(NULL);
tm_p=gmtime(&now);
tm_p=localtime(&now);
if((retval=WaitForSingleObject(exec_mutex,5000))!=WAIT_OBJECT_0) {
errormsg(WHERE, ERR_TIMEOUT, "exec_mutex", retval);
......
......@@ -213,7 +213,7 @@ int unixtojulian(time_t unix_time)
long j;
struct tm * tm;
tm=gmtime(&unix_time);
tm=localtime(&unix_time);
if(tm==NULL)
return(0);
j=36525L*(1900+tm->tm_year);
......@@ -508,7 +508,7 @@ void sbbs_t::xtrndat(char *name, char *dropdir, uchar type, ulong tleft
,'Y'); /* 38: Error correcting connection */
write(file,str,strlen(str));
tm=gmtime(&ns_time);
tm=localtime(&ns_time);
if(tm!=NULL)
sprintf(str,"%c\r\n%c\r\n%u\r\n%lu\r\n%02d/%02d/%02d\r\n"
,(useron.misc&(NO_EXASCII|ANSI|COLOR))==ANSI
......@@ -521,8 +521,8 @@ void sbbs_t::xtrndat(char *name, char *dropdir, uchar type, ulong tleft
,TM_YEAR(tm->tm_year));
write(file,str,strlen(str));
tm=gmtime(&logontime);
tl=gmtime(&useron.laston);
tm=localtime(&logontime);
tl=localtime(&useron.laston);
if(tm!=NULL && tl!=NULL)
sprintf(str,"%02d:%02d\r\n%02d:%02d\r\n%u\r\n%u\r\n%lu\r\n"
"%lu\r\n%s\r\n%u\r\n%u\r\n"
......@@ -614,7 +614,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 */
tm=gmtime(&useron.laston);
tm=localtime(&useron.laston);
if(tm!=NULL)
sprintf(tmp,"%02d:%02d",tm->tm_hour,tm->tm_min);
str2pas(tmp,str);
......@@ -676,7 +676,7 @@ void sbbs_t::xtrndat(char *name, char *dropdir, uchar type, ulong tleft
write(file,&c,1); /* NetMailEntered */
write(file,&c,1); /* EchoMailEntered */
tm=gmtime(&logontime);
tm=localtime(&logontime);
if(tm!=NULL)
sprintf(tmp,"%02d:%02d",tm->tm_hour,tm->tm_min);
str2pas(tmp,str);
......@@ -763,7 +763,7 @@ void sbbs_t::xtrndat(char *name, char *dropdir, uchar type, ulong tleft
,useron.number); /* User number */
write(file,str,strlen(str));
tm=gmtime(&now);
tm=localtime(&now);
if(tm!=NULL)
sprintf(str,"%lu\r\n%02d:%02d\r\n%02d:%02d %02d/%02d/%02d\r\n%s\r\n"
,tleft /* Time left in seconds */
......@@ -774,7 +774,7 @@ void sbbs_t::xtrndat(char *name, char *dropdir, uchar type, ulong tleft
,nulstr); /* Conferences with access */
write(file,str,strlen(str));
tm=gmtime(&useron.laston);
tm=localtime(&useron.laston);
if(tm!=NULL)
sprintf(str,"%u\r\n%u\r\n%u\r\n%u\r\n%s\r\n%s %02u:%02u\r\n"
,0 /* Daily download total */
......@@ -787,7 +787,7 @@ void sbbs_t::xtrndat(char *name, char *dropdir, uchar type, ulong tleft
,tm->tm_min);
write(file,str,strlen(str));
tm=gmtime(&ns_time);
tm=localtime(&ns_time);
if(tm!=NULL)
sprintf(str,"%s\r\n%s\r\n%02d/%02d/%02d\r\n%u\r\n%lu\r\n%u"
"\r\n%u\r\n%u\r\n"
......@@ -813,7 +813,7 @@ void sbbs_t::xtrndat(char *name, char *dropdir, uchar type, ulong tleft
,"Normal Connection"); /* Normal or ARQ connect */
write(file,str,strlen(str));
tm=gmtime(&now);
tm=localtime(&now);
if(tm!=NULL)
sprintf(str,"%02d/%02d/%02d %02d:%02d\r\n%u\r\n%u\r\n"
,tm->tm_mon+1,tm->tm_mday /* Current date MM/DD/YY */
......@@ -858,7 +858,7 @@ void sbbs_t::xtrndat(char *name, char *dropdir, uchar type, ulong tleft
,useron.pass); /* User's password */
write(file,str,27);
tm=gmtime(&logontime);
tm=localtime(&logontime);
if(tm==NULL)
i=0;
else
......@@ -965,7 +965,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 */
tm=gmtime(&useron.laston);
tm=localtime(&useron.laston);
if(tm!=NULL)
sprintf(str,"%02d:%02d",tm->tm_hour,tm->tm_min);
write(file,str,6); /* Last time on */
......@@ -1030,7 +1030,7 @@ void sbbs_t::xtrndat(char *name, char *dropdir, uchar type, ulong tleft
}
now=time(NULL);
tm=gmtime(&now);
tm=localtime(&now);
if(tm==NULL)
l=0;
else
......@@ -1053,7 +1053,7 @@ void sbbs_t::xtrndat(char *name, char *dropdir, uchar type, ulong tleft
);
write(file,str,strlen(str));
tm=gmtime(&logontime);
tm=localtime(&logontime);
if(tm==NULL)
l=0;
else
......
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