Commit b2ae0b1b authored by rswindell's avatar rswindell
Browse files

Resolve 64-bit time_t issues with combination MSVC10/BCB6 builds by making

all exported functions and data types using a 32-bit time_t (time32_t).
(part 2 of 2)
parent 33d6f26c
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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)
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
......@@ -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++) {
......
......@@ -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;
......
......@@ -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=' ';
......
......@@ -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 */
......
......@@ -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);
......
......@@ -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"
......
......@@ -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);
......
......@@ -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
......
......@@ -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 */
......
......@@ -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);
}
......
......@@ -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);
......
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