diff --git a/docs/notework.txt b/docs/notework.txt index 8ed60b4..6ada6d4 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -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) diff --git a/golded3/gectrl.cpp b/golded3/gectrl.cpp index cde3c0f..1f20366 100644 --- a/golded3/gectrl.cpp +++ b/golded3/gectrl.cpp @@ -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, diff --git a/golded3/gehdrs.cpp b/golded3/gehdrs.cpp index 0571a4c..1131d5f 100644 --- a/golded3/gehdrs.cpp +++ b/golded3/gehdrs.cpp @@ -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 diff --git a/golded3/geline.cpp b/golded3/geline.cpp index d53f080..f11e2ee 100644 --- a/golded3/geline.cpp +++ b/golded3/geline.cpp @@ -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; diff --git a/golded3/gemlst.cpp b/golded3/gemlst.cpp index 8c6e2fd..f7bff39 100644 --- a/golded3/gemlst.cpp +++ b/golded3/gemlst.cpp @@ -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, " "); diff --git a/golded3/gemsgs.cpp b/golded3/gemsgs.cpp index 82e5d4b..0532cb6 100644 --- a/golded3/gemsgs.cpp +++ b/golded3/gemsgs.cpp @@ -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]; diff --git a/golded3/gepost.cpp b/golded3/gepost.cpp index a3fe918..4ac6ca2 100644 --- a/golded3/gepost.cpp +++ b/golded3/gepost.cpp @@ -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; diff --git a/golded3/geqwks.cpp b/golded3/geqwks.cpp index 573c7b1..3649635 100644 --- a/golded3/geqwks.cpp +++ b/golded3/geqwks.cpp @@ -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); diff --git a/golded3/geread.cpp b/golded3/geread.cpp index 726fe8c..0c94bfc 100644 --- a/golded3/geread.cpp +++ b/golded3/geread.cpp @@ -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++; diff --git a/golded3/gesoup.cpp b/golded3/gesoup.cpp index 678748c..7b43343 100644 --- a/golded3/gesoup.cpp +++ b/golded3/gesoup.cpp @@ -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; diff --git a/golded3/geusrbse.cpp b/golded3/geusrbse.cpp index acc11d1..0501616 100644 --- a/golded3/geusrbse.cpp +++ b/golded3/geusrbse.cpp @@ -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; diff --git a/golded3/geutil.cpp b/golded3/geutil.cpp index 4c4ac94..514b058 100644 --- a/golded3/geutil.cpp +++ b/golded3/geutil.cpp @@ -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) diff --git a/golded3/geutil2.cpp b/golded3/geutil2.cpp index dcfcd1f..d67bdae 100644 --- a/golded3/geutil2.cpp +++ b/golded3/geutil2.cpp @@ -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; diff --git a/golded3/geview.cpp b/golded3/geview.cpp index 148ea87..8889083 100644 --- a/golded3/geview.cpp +++ b/golded3/geview.cpp @@ -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); diff --git a/goldlib/gall/gfilutl1.cpp b/goldlib/gall/gfilutl1.cpp index e0a184c..a135125 100644 --- a/goldlib/gall/gfilutl1.cpp +++ b/goldlib/gall/gfilutl1.cpp @@ -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; diff --git a/goldlib/gall/glog.cpp b/goldlib/gall/glog.cpp index 59daac9..7a8a78d 100644 --- a/goldlib/gall/glog.cpp +++ b/goldlib/gall/glog.cpp @@ -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++; diff --git a/goldlib/gall/gtimall.h b/goldlib/gall/gtimall.h index 56b4704..09d1ed9 100644 --- a/goldlib/gall/gtimall.h +++ b/goldlib/gall/gtimall.h @@ -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); -} // ------------------------------------------------------------------ diff --git a/goldlib/gall/gtimutil.cpp b/goldlib/gall/gtimutil.cpp index 4e5337c..aca4682 100644 --- a/goldlib/gall/gtimutil.cpp +++ b/goldlib/gall/gtimutil.cpp @@ -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)); } diff --git a/goldlib/gmb3/gmofido3.cpp b/goldlib/gmb3/gmofido3.cpp index 940827d..728757e 100644 --- a/goldlib/gmb3/gmofido3.cpp +++ b/goldlib/gmb3/gmofido3.cpp @@ -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; diff --git a/goldlib/gmb3/gmofido4.cpp b/goldlib/gmb3/gmofido4.cpp index 82e761a..ca30e6d 100644 --- a/goldlib/gmb3/gmofido4.cpp +++ b/goldlib/gmb3/gmofido4.cpp @@ -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 diff --git a/goldlib/gmb3/gmohuds3.cpp b/goldlib/gmb3/gmohuds3.cpp index 52f1bf3..3290611 100644 --- a/goldlib/gmb3/gmohuds3.cpp +++ b/goldlib/gmb3/gmohuds3.cpp @@ -135,7 +135,7 @@ int _HudsArea::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; diff --git a/goldlib/gmb3/gmohuds4.cpp b/goldlib/gmb3/gmohuds4.cpp index 29e1ffe..5909f78 100644 --- a/goldlib/gmb3/gmohuds4.cpp +++ b/goldlib/gmb3/gmohuds4.cpp @@ -127,7 +127,7 @@ void _HudsArea::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)); diff --git a/goldlib/gmb3/gmojamm2.cpp b/goldlib/gmb3/gmojamm2.cpp index 5d568fd..49ad126 100644 --- a/goldlib/gmb3/gmojamm2.cpp +++ b/goldlib/gmb3/gmojamm2.cpp @@ -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; diff --git a/goldlib/gmb3/gmopcbd3.cpp b/goldlib/gmb3/gmopcbd3.cpp index 07fc497..7412480 100644 --- a/goldlib/gmb3/gmopcbd3.cpp +++ b/goldlib/gmb3/gmopcbd3.cpp @@ -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; diff --git a/goldlib/gmb3/gmopcbd4.cpp b/goldlib/gmb3/gmopcbd4.cpp index b1d58e5..6f71418 100644 --- a/goldlib/gmb3/gmopcbd4.cpp +++ b/goldlib/gmb3/gmopcbd4.cpp @@ -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); diff --git a/goldlib/gmb3/gmosmb1.cpp b/goldlib/gmb3/gmosmb1.cpp index f2ce7df..380bf19 100644 --- a/goldlib/gmb3/gmosmb1.cpp +++ b/goldlib/gmb3/gmosmb1.cpp @@ -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); } diff --git a/goldlib/gmb3/gmosqsh4.cpp b/goldlib/gmb3/gmosqsh4.cpp index 7b28186..7d4e701 100644 --- a/goldlib/gmb3/gmosqsh4.cpp +++ b/goldlib/gmb3/gmosqsh4.cpp @@ -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 diff --git a/goldlib/gmb3/gmowcat3.cpp b/goldlib/gmb3/gmowcat3.cpp index c3b69bd..1e5cc9e 100644 --- a/goldlib/gmb3/gmowcat3.cpp +++ b/goldlib/gmb3/gmowcat3.cpp @@ -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; diff --git a/goldlib/gmb3/gmowcat4.cpp b/goldlib/gmb3/gmowcat4.cpp index 21312a9..6079321 100644 --- a/goldlib/gmb3/gmowcat4.cpp +++ b/goldlib/gmb3/gmowcat4.cpp @@ -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; } diff --git a/goldlib/gmb3/gmowcat5.cpp b/goldlib/gmb3/gmowcat5.cpp index f821710..c0b1f3e 100644 --- a/goldlib/gmb3/gmowcat5.cpp +++ b/goldlib/gmb3/gmowcat5.cpp @@ -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); diff --git a/goldlib/gmb3/gmoxbbs3.cpp b/goldlib/gmb3/gmoxbbs3.cpp index 95b5063..981e581 100644 --- a/goldlib/gmb3/gmoxbbs3.cpp +++ b/goldlib/gmb3/gmoxbbs3.cpp @@ -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; diff --git a/goldlib/gmb3/gmoxbbs4.cpp b/goldlib/gmb3/gmoxbbs4.cpp index bbc5f9a..b351758 100644 --- a/goldlib/gmb3/gmoxbbs4.cpp +++ b/goldlib/gmb3/gmoxbbs4.cpp @@ -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);