Commit de0c44e2 authored by deuce's avatar deuce
Browse files

More 64-bit time_t updates

parent db80d6a8
......@@ -961,7 +961,7 @@ char* sbbs_t::atcode(char* sp, char* str, size_t maxlen)
if(!strcmp(sp,"MSG_SUBJECT") && current_msg!=NULL)
return(current_msg->subj==NULL ? nulstr : current_msg->subj);
if(!strcmp(sp,"MSG_DATE") && current_msg!=NULL)
return(timestr((time_t *)&current_msg->hdr.when_written.time));
return(time32str((time32_t *)&current_msg->hdr.when_written.time));
if(!strcmp(sp,"MSG_TIMEZONE") && current_msg!=NULL)
return(smb_zonestr(current_msg->hdr.when_written.zone,NULL));
if(!strcmp(sp,"MSG_ATTR") && current_msg!=NULL) {
......
......@@ -518,7 +518,9 @@ int sbbs_t::exec_misc(csi_t* csi, char *path)
lp=getintvar(csi,*(int32_t *)csi->ip);
csi->ip+=4;
if(pp && lp) {
if(localtime_r((time_t *)lp,&tm)!=NULL) {
time_t tt;
tt=*lp;
if(localtime_r(&tt,&tm)!=NULL) {
strftime(buf,128,str,&tm);
*pp=copystrvar(csi,*pp,buf);
}
......@@ -530,7 +532,7 @@ int sbbs_t::exec_misc(csi_t* csi, char *path)
lp=getintvar(csi,*(int32_t *)csi->ip);
csi->ip+=4; /* Skip int variable name */
if(pp && lp) {
strcpy(str,timestr((time_t *)lp));
strcpy(str,time32str(lp));
*pp=copystrvar(csi,*pp,str); }
return(0);
case DATE_STR:
......
......@@ -153,7 +153,7 @@ void sbbs_t::show_msghdr(smbmsg_t* msg)
bprintf(text[MsgFromNet],smb_netaddr(&msg->from_net));
}
bprintf(text[MsgDate]
,timestr((time_t *)&msg->hdr.when_written.time)
,time32str((time32_t *)&msg->hdr.when_written.time)
,smb_zonestr(msg->hdr.when_written.zone,NULL));
CRLF;
......@@ -163,7 +163,7 @@ void sbbs_t::show_msghdr(smbmsg_t* msg)
sender=(char *)msg->hfield_dat[i];
if(msg->hfield[i].type==FORWARDED && sender)
bprintf(text[ForwardedFrom],sender
,timestr((time_t *)msg->hfield_dat[i])); }
,time32str((time32_t *)msg->hfield_dat[i])); }
/* Debug stuff
if(SYSOP) {
......@@ -231,7 +231,7 @@ void sbbs_t::msgtotxt(smbmsg_t* msg, char *str, int header, int tails)
if(msg->from_net.addr)
fprintf(out," (%s)",smb_netaddr(&msg->from_net));
fprintf(out,"\r\nDate : %.24s %s"
,timestr((time_t *)&msg->hdr.when_written.time)
,time32str((time32_t *)&msg->hdr.when_written.time)
,smb_zonestr(msg->hdr.when_written.zone,NULL));
fprintf(out,"\r\n\r\n"); }
......
......@@ -53,6 +53,7 @@ ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, int subnum
int i;
struct tm tm;
smbmsg_t remsg;
time_t tt;
offset=ftell(qwk_fp);
memset(str,' ',QWK_BLOCK_LEN);
......@@ -162,7 +163,7 @@ ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, int subnum
p=(char *)msg->hfield_dat[i];
if(msg->hfield[i].type==FORWARDED && p) {
sprintf(str,"Forwarded from %s on %s%c",p
,timestr((time_t *)msg->hfield_dat[i])
,time32str((time32_t *)msg->hfield_dat[i])
,QWK_NEWLINE);
fwrite(str,strlen(str),1,qwk_fp);
size+=strlen(str);
......@@ -330,7 +331,8 @@ ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, int subnum
size++;
fputc(' ',qwk_fp); }
if(localtime_r((time_t *)&msg->hdr.when_written.time,&tm)==NULL)
tt=msg->hdr.when_written.time;
if(localtime_r(&tt,&tm)==NULL)
memset(&tm,0,sizeof(tm));
sprintf(tmp,"%02u-%02u-%02u%02u:%02u"
......
......@@ -86,7 +86,7 @@ bool sbbs_t::postmsg(uint subnum, smbmsg_t *remsg, long wm_mode)
SAFECOPY(touser,from);
msgattr=(ushort)(remsg->hdr.attr&MSG_PRIVATE);
sprintf(top,text[RegardingByToOn],title,from,remsg->to
,timestr((time_t *)&remsg->hdr.when_written.time)
,time32str((time32_t *)&remsg->hdr.when_written.time)
,smb_zonestr(remsg->hdr.when_written.zone,NULL));
} else {
title[0]=0;
......
......@@ -384,7 +384,7 @@ void sbbs_t::readmail(uint usernumber, int which)
sprintf(str2,text[Regarding],msg.subj);
else /* Reply to other */
sprintf(str2,text[RegardingByOn],msg.subj,msg.from
,timestr((time_t *)&msg.hdr.when_written.time));
,time32str((time32_t *)&msg.hdr.when_written.time));
p=strrchr(str,'@');
if(p) { /* name @addr */
......
......@@ -119,9 +119,9 @@ void sbbs_t::msghdr(smbmsg_t* msg)
/* fixed fields */
bprintf("%-16.16s %s %s\r\n","when_written"
,timestr((time_t *)&msg->hdr.when_written.time), smb_zonestr(msg->hdr.when_written.zone,NULL));
,time32str((time32_t *)&msg->hdr.when_written.time), smb_zonestr(msg->hdr.when_written.zone,NULL));
bprintf("%-16.16s %s %s\r\n","when_imported"
,timestr((time_t *)&msg->hdr.when_imported.time), smb_zonestr(msg->hdr.when_imported.zone,NULL));
,time32str((time32_t *)&msg->hdr.when_imported.time), smb_zonestr(msg->hdr.when_imported.zone,NULL));
bprintf("%-16.16s %04Xh\r\n","type" ,msg->hdr.type);
bprintf("%-16.16s %04Xh\r\n","version" ,msg->hdr.version);
bprintf("%-16.16s %04Xh\r\n","attr" ,msg->hdr.attr);
......@@ -143,12 +143,12 @@ void sbbs_t::msghdr(smbmsg_t* msg)
if(msg->hdr.times_downloaded)
bprintf("%-16.16s %lu\r\n" ,"times_downloaded" ,msg->hdr.times_downloaded);
if(msg->hdr.last_downloaded)
bprintf("%-16.16s %s\r\n" ,"last_downloaded" ,timestr((time_t*)&msg->hdr.last_downloaded));
bprintf("%-16.16s %s\r\n" ,"last_downloaded" ,time32str((time32_t *)&msg->hdr.last_downloaded));
/* convenience integers */
if(msg->expiration)
bprintf("%-16.16s %s\r\n" ,"expiration"
,timestr((time_t *)&msg->expiration));
,time32str((time32_t *)&msg->expiration));
if(msg->priority)
bprintf("%-16.16s %lu\r\n" ,"priority" ,msg->priority);
if(msg->cost)
......@@ -813,7 +813,7 @@ int sbbs_t::scanposts(uint subnum, long mode, char *find)
break;
sprintf(str2,text[Regarding]
,msg.subj
,timestr((time_t *)&msg.hdr.when_written.time));
,time32str((time32_t *)&msg.hdr.when_written.time));
if(msg.from_net.addr==NULL)
strcpy(str,msg.from);
else if(msg.from_net.type==NET_FIDO)
......
......@@ -3515,6 +3515,7 @@ void export_echomail(char *sub_code,faddr_t addr)
areasbbs_t fakearea;
addrlist_t msg_seen,msg_path;
clock_t start_tick=0,export_ticks=0;
time_t tt;
memset(&msg_seen,0,sizeof(addrlist_t));
memset(&msg_path,0,sizeof(addrlist_t));
......@@ -3643,7 +3644,8 @@ void export_echomail(char *sub_code,faddr_t addr)
SAFECOPY(hdr.from,msg.from);
tm=localtime((time_t *)&msg.hdr.when_written.time);
tt=msg.hdr.when_written.time;
tm=localtime(&tt);
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);
......
......@@ -3518,6 +3518,7 @@ js_set_cookie(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval
JSBool b;
struct tm tm;
http_session_t* session;
time_t tt;
if((session=(http_session_t*)JS_GetContextPrivate(cx))==NULL)
return(JS_FALSE);
......@@ -3536,7 +3537,8 @@ js_set_cookie(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval
header+=sprintf(header,"%s",p);
if(argc>2) {
JS_ValueToInt32(cx,argv[2],&i);
if(i && gmtime_r((time_t *)&i,&tm)!=NULL)
tt=i;
if(i && gmtime_r(&tt,&tm)!=NULL)
header += strftime(header,50,"; expires=%a, %d-%b-%Y %H:%M:%S GMT",&tm);
}
if(argc>3) {
......
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