All gmtime and localtime calls was rewritten to internal defined functions

This commit is contained in:
Ianos Gnatiuc 2005-10-17 19:51:33 +00:00
parent d5b32cade9
commit 50c20ae93d
32 changed files with 87 additions and 79 deletions

View File

@ -10,6 +10,8 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, /snapshot/
______________________________________________________________________
- All gmtime and localtime calls was rewritten to internal defined functions.
- GoldEd can fall because of invalid time in message.
(bugreport from Alexander Kolyada)

View File

@ -575,7 +575,7 @@ void DoKludges(int mode, GMsg* msg, int kludges) {
line->kludge = GKLUD_RFC;
}
struct tm* tm = gmtime(&msg->written);
struct tm* tm = ggmtime(&msg->written);
sprintf(buf, "%sDate: %s, %02d %s %04d %02d:%02d:%02d", rfc,
__gsweekday[tm->tm_wday],
tm->tm_mday, __gsmonth[tm->tm_mon], 1900+tm->tm_year,

View File

@ -177,7 +177,7 @@ void DispHeader(GMsg* msg, bool prn, FILE* fp, int width) {
strsetsz(buf1, nodewidth);
if(msg->written)
strftimei(buf2, CFG->disphdrdateset.len, LNG->DateTimeFmt, gmtime(&msg->written));
strftimei(buf2, CFG->disphdrdateset.len, LNG->DateTimeFmt, ggmtime(&msg->written));
strsetsz(buf2, datewidth);
// write from line
@ -206,7 +206,7 @@ void DispHeader(GMsg* msg, bool prn, FILE* fp, int width) {
strsetsz(buf2, nodewidth);
if(msg->arrived)
strftimei(buf2, CFG->disphdrdateset.len, LNG->DateTimeFmt, gmtime(&msg->arrived));
strftimei(buf2, CFG->disphdrdateset.len, LNG->DateTimeFmt, ggmtime(&msg->arrived));
strsetsz(buf2, datewidth);
// write to line

View File

@ -798,7 +798,7 @@ void KludgeDATE(GMsg* msg, const char* ptr) {
t.tm_sec = second;
t.tm_isdst = -1;
time_t a = mktime(&t);
struct tm *tp = gmtime(&a);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
msg->written = a + a - b;

View File

@ -321,7 +321,7 @@ void GMsgList::print_line(uint idx, uint pos, bool isbar) {
case MSGLISTDATE_RECEIVED: dt = ml->received; break;
}
if(dt)
strftimei(dbuf, 20, "%d %b %y", gmtime(&dt));
strftimei(dbuf, 20, "%d %b %y", ggmtime(&dt));
if(AA->Msglistdate())
strsetsz(dbuf, 10);
else
@ -909,7 +909,7 @@ void GThreadlist::print_line(uint idx, uint pos, bool isbar) {
}
if(dt)
strftimei(dbuf, 20, "%d %b %y", gmtime(&dt));
strftimei(dbuf, 20, "%d %b %y", ggmtime(&dt));
strcat(buf, dbuf);
}
strcat(buf, " ");

View File

@ -107,14 +107,14 @@ char* TokenXlat(int mode, char* input, GMsg* msg, GMsg* oldmsg, int __origarea)
const char *osver = ggetosstring();
time_t t = time(NULL);
struct tm* written_tm = localtime(&t);
struct tm* written_tm = glocaltime(&t);
char cdate[80];
strftimei(cdate, 80, LNG->DateFmt, written_tm);
char ctime[80];
strftimei(ctime, 80, LNG->TimeFmt, written_tm);
char cdtime[80];
strftimei(cdtime, 80, LNG->DateTimeFmt, written_tm);
written_tm = gmtime(&oldmsg->written);
written_tm = ggmtime(&oldmsg->written);
char odate[80];
strftimei(odate, 80, LNG->DateFmt, written_tm);
char otime[80];

View File

@ -244,7 +244,7 @@ static void MakeMsg3(int& mode, GMsg* msg) {
// Do Timefields
if(msg->attr.fmu()) {
time_t a = time(NULL);
struct tm *tp = gmtime(&a);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
a += a - b;
@ -825,7 +825,7 @@ void MakeMsg(int mode, GMsg* omsg, bool ignore_replyto) {
}
if(dochgdate) {
time_t a = time(NULL);
struct tm *tp = gmtime(&a);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
a += a - b;

View File

@ -209,12 +209,12 @@ int ImportQWK() {
_tm.tm_sec = 0;
_tm.tm_isdst = -1;
time_t a = mktime(&_tm);
struct tm *tp = gmtime(&a);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
msg->written = a + a - b;
a = time(NULL);
tp = gmtime(&a);
tp = ggmtime(&a);
tp->tm_isdst = -1;
b = mktime(tp);
msg->arrived = a + a - b;
@ -369,7 +369,7 @@ int ExportQwkMsg(GMsg* msg, gfile& fp, int confno, int& pktmsgno) {
hdr.status = msg->attr.pvt() ? '*' : ' ';
sprintf(buf, "%u", confno);
memcpy(hdr.msgno, buf, strlen(buf));
struct tm* _tm = gmtime(&msg->written);
struct tm* _tm = ggmtime(&msg->written);
int _year = _tm->tm_year % 100;
sprintf(buf, "%02d-%02d-%02d", _tm->tm_mon+1, _tm->tm_mday, _year);
memcpy(hdr.date, buf, 8);

View File

@ -1175,7 +1175,7 @@ int LoadMessage(GMsg* msg, int margin) {
reader_rcv_noise = 1;
if(not msg->attr.rcv()) { // Have we seen it?
time_t a = time(NULL);
struct tm *tp = gmtime(&a);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
msg->received = a + a - b; // Get current date
@ -1419,7 +1419,7 @@ void GotoReplies() {
sprintf(rlist[replies].addr, " (%s) ", buf);
}
maxaddr = MaxV(maxaddr, (uint)strlen(rlist[replies].addr));
strftimei(rlist[replies].written, CFG->disphdrdateset.len, LNG->DateTimeFmt, gmtime(&rmsg->written));
strftimei(rlist[replies].written, CFG->disphdrdateset.len, LNG->DateTimeFmt, ggmtime(&rmsg->written));
maxwritten = MaxV(maxwritten, (uint)strlen(rlist[replies].written));
rlist[replies].reln = reln;
replies++;

View File

@ -172,7 +172,7 @@ void ProcessSoupMsg(char* lbuf, GMsg* msg, int& msgs, char* areaname, int tossto
msg->orig = msg->oorig = CFG->internetgate.addr.valid() ? CFG->internetgate.addr : AA->aka();
msg->dest = msg->odest = AA->aka();
time_t a = time(NULL);
struct tm *tp = gmtime(&a);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
msg->arrived = a + a - b;
@ -698,7 +698,7 @@ int ExportSoupMsg(GMsg* msg, char* msgfile, gfile& fp, int ismail) {
msg->attr.scn1();
msg->attr.uns0();
time_t a = time(NULL);
struct tm *tp = gmtime(&a);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
msg->arrived = a + a - b;

View File

@ -344,10 +344,10 @@ bool guserbase::edit_entry(uint idx) {
char dbuf[16];
time_t dt = entry.firstdate;
if(dt)
window.prints(13, 13, wattr, strftimei(dbuf, 16, "%d %b %y", gmtime(&dt)));
window.prints(13, 13, wattr, strftimei(dbuf, 16, "%d %b %y", ggmtime(&dt)));
dt = entry.lastdate;
if(dt)
window.prints(13, 38, wattr, strftimei(dbuf, 16, "%d %b %y", gmtime(&dt)));
window.prints(13, 38, wattr, strftimei(dbuf, 16, "%d %b %y", ggmtime(&dt)));
sprintf(dbuf, "%8ld", entry.times);
window.prints(13, width-11, wattr, dbuf);
@ -428,7 +428,7 @@ void guserbase::write_entry(uint idx, bool updateit) {
if(updateit and not entry.is_deleted) {
time_t a = time(NULL);
struct tm *tp = gmtime(&a);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
entry.lastdate = a + a - b;

View File

@ -55,7 +55,7 @@ void update_statuslines() {
if(CFG->switches.get(statuslineclock)) {
time_t t = time(NULL);
sprintf(clkinfo, " %s", strftimei(help, 40, LNG->StatusLineTimeFmt, localtime(&t)));
sprintf(clkinfo, " %s", strftimei(help, 40, LNG->StatusLineTimeFmt, glocaltime(&t)));
}
if(CFG->statuslinehelp == -1)

View File

@ -268,7 +268,7 @@ void ScreenBlankIdle() {
char blankmsg1[80];
char blankmsg2[80];
time_t t = time(NULL);
sprintf(blankmsg1, " %s %s %s ", __gver_longpid__, __gver_ver__, strftimei(blankmsg2, 40, LNG->StatusLineTimeFmt, localtime(&t)));
sprintf(blankmsg1, " %s %s %s ", __gver_longpid__, __gver_ver__, strftimei(blankmsg2, 40, LNG->StatusLineTimeFmt, glocaltime(&t)));
sprintf(blankmsg2, " %s ", LNG->BlankMsg);
if(strblank(blankmsg2)) {
*blankmsg2 = NUL;

View File

@ -216,7 +216,7 @@ void GMsgHeaderView::Paint() {
if(datewidth > 0) {
if(msg->written)
strftimei(buf, datewidth, LNG->DateTimeFmt, gmtime(&msg->written));
strftimei(buf, datewidth, LNG->DateTimeFmt, ggmtime(&msg->written));
else
*buf = NUL;
strsetsz(buf, datewidth);
@ -254,7 +254,7 @@ void GMsgHeaderView::Paint() {
if(datewidth > 0) {
if(msg->arrived)
strftimei(buf, datewidth, LNG->DateTimeFmt, gmtime(&msg->arrived));
strftimei(buf, datewidth, LNG->DateTimeFmt, ggmtime(&msg->arrived));
else
*buf = NUL;
strsetsz(buf, datewidth);

View File

@ -99,9 +99,9 @@ long GetFilesize(const char* file) {
dword gfixstattime(time_t st_time) {
#if (defined(__MINGW32__) && !defined(__MSVCRT__)) || defined(__CYGWIN__)
struct tm &f = *gmtime(&st_time);
struct tm &f = *ggmtime(&st_time);
#else
struct tm &f = *localtime(&st_time);
struct tm &f = *glocaltime(&st_time);
#endif
FFTime t;
t.ft_year = f.tm_year - 80;

View File

@ -109,7 +109,7 @@ void glog::printf(const char* format, ...) {
char logbuf[256];
secs_now = time(NULL);
time_now = localtime(&secs_now);
time_now = glocaltime(&secs_now);
lineswritten++;

View File

@ -123,19 +123,39 @@ extern const char* gmonths[];
// ------------------------------------------------------------------
// Prototypes
#if defined(__WIN32__) && MAXINT > 0x0FFFFFFF // 64-bit
extern struct tm dummy_struct_tm;
inline struct tm* ggmtime(time_t* arg) {
struct tm* a = gmtime(arg);
return (a != NULL) ? a : &dummy_struct_tm;
}
inline struct tm* glocaltime(time_t* arg) {
struct tm* a = localtime(arg);
return (a != NULL) ? a : &dummy_struct_tm;
}
#define gmtime(arg) ggmtime(arg)
#define localtime(arg) glocaltime(arg)
inline struct tm *ggmtime(const time_t *timep)
{
#if defined(__WIN32__)
const time_t zero(0);
struct tm *time = gmtime(timep);
return time ? time : gmtime(&zero);
#else
return gmtime(&timep);
#endif
}
inline struct tm* glocaltime(const time_t *timep)
{
#if defined(__WIN32__)
const time_t zero(0);
struct tm *time = localtime(timep);
return time ? time : localtime(&zero);
#else
return localtime(timep);
#endif
}
inline struct tm* ggmtime(const time32_t *timep)
{
const time_t temp(*timep);
return glocaltime(&temp);
}
inline struct tm* glocaltime(const time32_t *timep)
{
const time_t temp(*timep);
return glocaltime(&temp);
}
#if defined(__OS2__)
inline void usleep(long duration) { DosSleep(duration); }
@ -172,13 +192,6 @@ char* TimeToStr(char* buf, time_t t);
long YMD2JDN(unsigned yr, unsigned mo, unsigned day) __attribute__ ((const));
void JDN2YMD(long scalar, unsigned *yr, unsigned *mo, unsigned *day);
inline struct tm *gmtime(const time32_t *timep)
{
const time_t zero(0);
const time_t temp(*timep);
struct tm *time = gmtime(&temp);
return time ? time : gmtime(&zero);
}
// ------------------------------------------------------------------

View File

@ -43,13 +43,6 @@
#endif
// ------------------------------------------------------------------
#ifdef __WIN32__
struct tm dummy_struct_tm = { 0, 0, 0, 1, 0, 70, 0, 0, -1 };
#endif
// ------------------------------------------------------------------
const char* gmonths[] = {
@ -68,7 +61,7 @@ const char* gmonths[] = {
int tzoffset() {
time_t t1 = time(NULL);
struct tm *tp = gmtime(&t1);
struct tm *tp = ggmtime(&t1);
tp->tm_isdst=-1;
time_t t2 = mktime(tp);
int dt = (int)(t1 - t2);
@ -358,7 +351,7 @@ time_t FTimeToTime(FTime* __ftime, struct tm* __tm) {
__tm->tm_isdst = -1;
time_t a = mktime(__tm);
struct tm *tp = gmtime(&a);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
_time = a + a - b;
@ -382,7 +375,7 @@ FTime TimeToFTime(time_t __time) {
if(__time) {
struct tm* _tmp = gmtime(&__time);
struct tm* _tmp = ggmtime(&__time);
_ft.ft_year = (word)(_tmp->tm_year - 80);
_ft.ft_month = (word)(_tmp->tm_mon + 1);
_ft.ft_day = (word)(_tmp->tm_mday);
@ -449,7 +442,7 @@ time_t FidoTimeToUnix(char* ptr) {
t.tm_sec = second;
t.tm_isdst = -1;
time_t a = mktime(&t);
struct tm *tp = gmtime(&a);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
return a + a - b;
@ -462,7 +455,7 @@ time_t FidoTimeToUnix(char* ptr) {
char* TimeToStr(char* buf, time_t t) {
return strftimei(buf, 20, "%Y-%m-%d %H:%M:%S", gmtime(&t));
return strftimei(buf, 20, "%Y-%m-%d %H:%M:%S", ggmtime(&t));
}

View File

@ -98,7 +98,7 @@ int FidoArea::load_message(int __mode, gmsg* __msg, FidoHdr& __hdr) {
if(__msg->arrived == 0) {
time_t a = time(NULL);
struct tm *tp = gmtime(&a);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
__msg->arrived = a + a - b;

View File

@ -168,7 +168,7 @@ void FidoArea::save_message(int __mode, gmsg* __msg, FidoHdr& __hdr) {
__hdr.opus.written = TimeToFTime(__msg->written);
__hdr.opus.arrived = TimeToFTime(__msg->arrived);
}
struct tm* _tm = gmtime(&__msg->written);
struct tm* _tm = ggmtime(&__msg->written);
sprintf(__hdr.datetime, "%02d %3s %02d %02d:%02d:%02d",
_tm->tm_mday, gmonths[_tm->tm_mon+1], _tm->tm_year % 100,
_tm->tm_hour, _tm->tm_min, _tm->tm_sec

View File

@ -135,7 +135,7 @@ int _HudsArea<msgn_t, rec_t, attr_t, board_t, last_t, __HUDSON>::load_message(in
_tm.tm_sec = 0;
_tm.tm_isdst = -1;
time_t a = mktime(&_tm);
struct tm *tp = gmtime(&a);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
__msg->written = a + a - b;

View File

@ -127,7 +127,7 @@ void _HudsArea<msgn_t, rec_t, attr_t, board_t, last_t, __HUDSON>::save_message(i
__hdr.replyto = (msgn_t)__msg->link.to();
__hdr.reply1st = (msgn_t)__msg->link.first();
struct tm* _tmp = gmtime(&__msg->written);
struct tm* _tmp = ggmtime(&__msg->written);
strc2p(strftimei(__hdr.date, 9, "%m-%d-%y", _tmp));
strc2p(strftimei(__hdr.time, 6, "%H:%M", _tmp));

View File

@ -153,7 +153,7 @@ void JamArea::open_area() {
// Initialize header info
memcpy(data->hdrinfo.signature, JAM_SIGNATURE, 4);
time_t a = time(NULL);
struct tm *tp = gmtime(&a);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
data->hdrinfo.datecreated = a + a - b;

View File

@ -80,7 +80,7 @@ int PcbArea::load_message(int __mode, gmsg* __msg, PcbHdr& __hdr) {
_tm.tm_sec = 0;
_tm.tm_isdst = -1;
time_t a = mktime(&_tm);
struct tm *tp = gmtime(&a);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
__msg->written = a + a - b;

View File

@ -158,13 +158,13 @@ void PcbArea::save_message(int __mode, gmsg* __msg, PcbHdr& __hdr) {
// Convert dates and times
char _dtbuf[9];
struct tm* _tm = gmtime(&__msg->written);
struct tm* _tm = ggmtime(&__msg->written);
memcpy(__hdr.date, strftimei(_dtbuf, 9, __msg->attr.uns() ? "%d-%m-%y" : "%d-%m\xC4%y", _tm), 8);
memcpy(__hdr.time, strftimei(_dtbuf, 6, "%H:%M", _tm), 5);
_idx.date = (word)YMD2JDN(1900+_tm->tm_year, _tm->tm_mon+1, _tm->tm_mday);
if(__msg->link.first()) {
__hdr.hasreply = 'R';
_tm = gmtime(&__msg->pcboard.reply_written);
_tm = ggmtime(&__msg->pcboard.reply_written);
int _year = _tm->tm_year % 100;
__hdr.replydate = L2B((10000L*_year) + (100L*(_tm->tm_mon+1)) + _tm->tm_mday);
memcpy(__hdr.replytime, strftimei(_dtbuf, 6, "%H:%M", _tm), 5);

View File

@ -325,12 +325,12 @@ int SMBArea::load_hdr(gmsg* __msg, smbmsg_t *smsg)
__msg->attr.tfs(smsgp->hdr.auxattr & MSG_TRUNCFILE);
time_t a = smsgp->hdr.when_written.time;
struct tm *tp = gmtime(&a);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
__msg->written = a + a - b;
a = smsgp->hdr.when_imported.time;
b = mktime(gmtime(&a));
b = mktime(ggmtime(&a));
__msg->arrived = a + a - b;
__msg->received = 0;
@ -536,7 +536,7 @@ void SMBArea::save_hdr(int mode, gmsg* msg)
else {
memcpy(smsg.hdr.id, "SHD\x1a", 4);
smsg.hdr.version = smb_ver();
struct tm *tp = gmtime(&msg->written);
struct tm *tp = ggmtime(&msg->written);
tp->tm_isdst = -1;
smsg.hdr.when_written.time = mktime(tp);
}

View File

@ -437,7 +437,7 @@ void SquishArea::save_message(int __mode, gmsg* __msg) {
__hdr.date_written = TimeToFTime(__msg->written);
__hdr.date_arrived = TimeToFTime(__msg->arrived);
struct tm* _tm = gmtime(&__msg->written);
struct tm* _tm = ggmtime(&__msg->written);
sprintf(__hdr.ftsc_date, "%02d %3s %02d %02d:%02d:%02d",
_tm->tm_mday, gmonths[_tm->tm_mon+1], _tm->tm_year % 100,
_tm->tm_hour, _tm->tm_min, _tm->tm_sec

View File

@ -104,7 +104,7 @@ int WCatArea::load_message(int __mode, gmsg* __msg, WCatHdr& __hdr) {
_tm.tm_sec = _second;
_tm.tm_isdst = -1;
time_t a = mktime(&_tm);
struct tm *tp = gmtime(&a);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
__msg->written = a + a - b;
@ -124,7 +124,7 @@ int WCatArea::load_message(int __mode, gmsg* __msg, WCatHdr& __hdr) {
_tm.tm_sec = _second;
_tm.tm_isdst = -1;
time_t a = mktime(&_tm);
struct tm *tp = gmtime(&a);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
__msg->received = a + a - b;

View File

@ -119,13 +119,13 @@ void WCatArea::save_message(int __mode, gmsg* __msg, WCatHdr& __hdr) {
strc2p(strcpy(__hdr.network, __msg->wildcat.network));
if(__msg->written) {
struct tm* _tm = gmtime(&__msg->written);
struct tm* _tm = ggmtime(&__msg->written);
__hdr.msgdate = (word)(YMD2JDN(1900+_tm->tm_year, _tm->tm_mon+1, _tm->tm_mday)-1);
__hdr.msgtime = ((_tm->tm_hour*3600L)+(_tm->tm_min*60L)+_tm->tm_sec)+1;
}
if(__msg->received) {
struct tm* _tm = gmtime(&__msg->received);
struct tm* _tm = ggmtime(&__msg->received);
__hdr.readdate = (word)YMD2JDN(1900+_tm->tm_year, _tm->tm_mon+1, _tm->tm_mday);
__hdr.readtime = ((_tm->tm_hour*3600L)+(_tm->tm_min*60L)+_tm->tm_sec)+1;
}

View File

@ -77,8 +77,8 @@ Line* WCatArea::make_dump_msg(Line*& lin, gmsg* msg, char* lng_head) {
AddLineF(line, "DestUserID : %i", _hdr.touserid);
AddLineF(line, "Subject : %s", STRNP2C(_hdr.subject));
AddLineF(line, "Network : %s", STRNP2C(_hdr.network));
AddLineF(line, "MsgTime : %s (%u, %i)", strftimei(buf, 100, "%d %b %y %H:%M:%S", gmtime(&msg->written)), _hdr.msgdate, _hdr.msgtime);
AddLineF(line, "ReadTime : %s (%u, %i)", strftimei(buf, 100, "%d %b %y %H:%M:%S", gmtime(&msg->received)), _hdr.readdate, _hdr.readtime);
AddLineF(line, "MsgTime : %s (%u, %i)", strftimei(buf, 100, "%d %b %y %H:%M:%S", ggmtime(&msg->written)), _hdr.msgdate, _hdr.msgtime);
AddLineF(line, "ReadTime : %s (%u, %i)", strftimei(buf, 100, "%d %b %y %H:%M:%S", ggmtime(&msg->received)), _hdr.readdate, _hdr.readtime);
AddLineF(line, "mFlags : %u (%04Xh)", _hdr.mflags, _hdr.mflags);
AddLineF(line, "Reference : %u", _hdr.reference);
AddLineF(line, "FidoFrom : %u:%u/%u.%u", _hdr.origaddr.zone, _hdr.origaddr.net, _hdr.origaddr.node, _hdr.origaddr.point);

View File

@ -73,7 +73,7 @@ int XbbsArea::load_message(int __mode, gmsg* __msg, XbbsHdr& __hdr) {
t.tm_hour = t.tm_min = t.tm_sec = 0;
t.tm_isdst = -1;
time_t a = mktime(&t);
struct tm *tp = gmtime(&a);
struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
__msg->arrived = a + a - b;

View File

@ -135,13 +135,13 @@ void XbbsArea::save_message(int __mode, gmsg* __msg, XbbsHdr& __hdr) {
strxcpy(__hdr.to, __msg->to, sizeof(__hdr.to));
strxcpy(__hdr.subj, __msg->re, sizeof(__hdr.subj));
struct tm* _tm = gmtime(&__msg->written);
struct tm* _tm = ggmtime(&__msg->written);
sprintf(__hdr.date, "%02d %3s %02d %02d:%02d:%02d",
_tm->tm_mday, gmonths[_tm->tm_mon+1], _tm->tm_year % 100,
_tm->tm_hour, _tm->tm_min, _tm->tm_sec
);
if(__msg->arrived)
_tm = gmtime(&__msg->arrived);
_tm = ggmtime(&__msg->arrived);
__hdr.indate[0] = (byte)(_tm->tm_year - 89);
__hdr.indate[1] = (byte)(_tm->tm_mon + 1);
__hdr.indate[2] = (byte)(_tm->tm_mday);