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/ 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. - GoldEd can fall because of invalid time in message.
(bugreport from Alexander Kolyada) (bugreport from Alexander Kolyada)

View File

@ -575,7 +575,7 @@ void DoKludges(int mode, GMsg* msg, int kludges) {
line->kludge = GKLUD_RFC; 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, sprintf(buf, "%sDate: %s, %02d %s %04d %02d:%02d:%02d", rfc,
__gsweekday[tm->tm_wday], __gsweekday[tm->tm_wday],
tm->tm_mday, __gsmonth[tm->tm_mon], 1900+tm->tm_year, 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); strsetsz(buf1, nodewidth);
if(msg->written) 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); strsetsz(buf2, datewidth);
// write from line // write from line
@ -206,7 +206,7 @@ void DispHeader(GMsg* msg, bool prn, FILE* fp, int width) {
strsetsz(buf2, nodewidth); strsetsz(buf2, nodewidth);
if(msg->arrived) 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); strsetsz(buf2, datewidth);
// write to line // write to line

View File

@ -798,7 +798,7 @@ void KludgeDATE(GMsg* msg, const char* ptr) {
t.tm_sec = second; t.tm_sec = second;
t.tm_isdst = -1; t.tm_isdst = -1;
time_t a = mktime(&t); time_t a = mktime(&t);
struct tm *tp = gmtime(&a); struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1; tp->tm_isdst = -1;
time_t b = mktime(tp); time_t b = mktime(tp);
msg->written = a + a - b; 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; case MSGLISTDATE_RECEIVED: dt = ml->received; break;
} }
if(dt) if(dt)
strftimei(dbuf, 20, "%d %b %y", gmtime(&dt)); strftimei(dbuf, 20, "%d %b %y", ggmtime(&dt));
if(AA->Msglistdate()) if(AA->Msglistdate())
strsetsz(dbuf, 10); strsetsz(dbuf, 10);
else else
@ -909,7 +909,7 @@ void GThreadlist::print_line(uint idx, uint pos, bool isbar) {
} }
if(dt) if(dt)
strftimei(dbuf, 20, "%d %b %y", gmtime(&dt)); strftimei(dbuf, 20, "%d %b %y", ggmtime(&dt));
strcat(buf, dbuf); strcat(buf, dbuf);
} }
strcat(buf, " "); strcat(buf, " ");

View File

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

View File

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

View File

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

View File

@ -1175,7 +1175,7 @@ int LoadMessage(GMsg* msg, int margin) {
reader_rcv_noise = 1; reader_rcv_noise = 1;
if(not msg->attr.rcv()) { // Have we seen it? if(not msg->attr.rcv()) { // Have we seen it?
time_t a = time(NULL); time_t a = time(NULL);
struct tm *tp = gmtime(&a); struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1; tp->tm_isdst = -1;
time_t b = mktime(tp); time_t b = mktime(tp);
msg->received = a + a - b; // Get current date msg->received = a + a - b; // Get current date
@ -1419,7 +1419,7 @@ void GotoReplies() {
sprintf(rlist[replies].addr, " (%s) ", buf); sprintf(rlist[replies].addr, " (%s) ", buf);
} }
maxaddr = MaxV(maxaddr, (uint)strlen(rlist[replies].addr)); 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)); maxwritten = MaxV(maxwritten, (uint)strlen(rlist[replies].written));
rlist[replies].reln = reln; rlist[replies].reln = reln;
replies++; 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->orig = msg->oorig = CFG->internetgate.addr.valid() ? CFG->internetgate.addr : AA->aka();
msg->dest = msg->odest = AA->aka(); msg->dest = msg->odest = AA->aka();
time_t a = time(NULL); time_t a = time(NULL);
struct tm *tp = gmtime(&a); struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1; tp->tm_isdst = -1;
time_t b = mktime(tp); time_t b = mktime(tp);
msg->arrived = a + a - b; msg->arrived = a + a - b;
@ -698,7 +698,7 @@ int ExportSoupMsg(GMsg* msg, char* msgfile, gfile& fp, int ismail) {
msg->attr.scn1(); msg->attr.scn1();
msg->attr.uns0(); msg->attr.uns0();
time_t a = time(NULL); time_t a = time(NULL);
struct tm *tp = gmtime(&a); struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1; tp->tm_isdst = -1;
time_t b = mktime(tp); time_t b = mktime(tp);
msg->arrived = a + a - b; msg->arrived = a + a - b;

View File

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

View File

@ -55,7 +55,7 @@ void update_statuslines() {
if(CFG->switches.get(statuslineclock)) { if(CFG->switches.get(statuslineclock)) {
time_t t = time(NULL); 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) if(CFG->statuslinehelp == -1)

View File

@ -268,7 +268,7 @@ void ScreenBlankIdle() {
char blankmsg1[80]; char blankmsg1[80];
char blankmsg2[80]; char blankmsg2[80];
time_t t = time(NULL); 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); sprintf(blankmsg2, " %s ", LNG->BlankMsg);
if(strblank(blankmsg2)) { if(strblank(blankmsg2)) {
*blankmsg2 = NUL; *blankmsg2 = NUL;

View File

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

View File

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

View File

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

View File

@ -123,19 +123,39 @@ extern const char* gmonths[];
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Prototypes // Prototypes
#if defined(__WIN32__) && MAXINT > 0x0FFFFFFF // 64-bit inline struct tm *ggmtime(const time_t *timep)
extern struct tm dummy_struct_tm; {
inline struct tm* ggmtime(time_t* arg) { #if defined(__WIN32__)
struct tm* a = gmtime(arg); const time_t zero(0);
return (a != NULL) ? a : &dummy_struct_tm; struct tm *time = gmtime(timep);
} return time ? time : gmtime(&zero);
inline struct tm* glocaltime(time_t* arg) { #else
struct tm* a = localtime(arg); return gmtime(&timep);
return (a != NULL) ? a : &dummy_struct_tm;
}
#define gmtime(arg) ggmtime(arg)
#define localtime(arg) glocaltime(arg)
#endif #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__) #if defined(__OS2__)
inline void usleep(long duration) { DosSleep(duration); } 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)); long YMD2JDN(unsigned yr, unsigned mo, unsigned day) __attribute__ ((const));
void JDN2YMD(long scalar, unsigned *yr, unsigned *mo, unsigned *day); 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 #endif
// ------------------------------------------------------------------
#ifdef __WIN32__
struct tm dummy_struct_tm = { 0, 0, 0, 1, 0, 70, 0, 0, -1 };
#endif
// ------------------------------------------------------------------ // ------------------------------------------------------------------
const char* gmonths[] = { const char* gmonths[] = {
@ -68,7 +61,7 @@ const char* gmonths[] = {
int tzoffset() { int tzoffset() {
time_t t1 = time(NULL); time_t t1 = time(NULL);
struct tm *tp = gmtime(&t1); struct tm *tp = ggmtime(&t1);
tp->tm_isdst=-1; tp->tm_isdst=-1;
time_t t2 = mktime(tp); time_t t2 = mktime(tp);
int dt = (int)(t1 - t2); int dt = (int)(t1 - t2);
@ -358,7 +351,7 @@ time_t FTimeToTime(FTime* __ftime, struct tm* __tm) {
__tm->tm_isdst = -1; __tm->tm_isdst = -1;
time_t a = mktime(__tm); time_t a = mktime(__tm);
struct tm *tp = gmtime(&a); struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1; tp->tm_isdst = -1;
time_t b = mktime(tp); time_t b = mktime(tp);
_time = a + a - b; _time = a + a - b;
@ -382,7 +375,7 @@ FTime TimeToFTime(time_t __time) {
if(__time) { if(__time) {
struct tm* _tmp = gmtime(&__time); struct tm* _tmp = ggmtime(&__time);
_ft.ft_year = (word)(_tmp->tm_year - 80); _ft.ft_year = (word)(_tmp->tm_year - 80);
_ft.ft_month = (word)(_tmp->tm_mon + 1); _ft.ft_month = (word)(_tmp->tm_mon + 1);
_ft.ft_day = (word)(_tmp->tm_mday); _ft.ft_day = (word)(_tmp->tm_mday);
@ -449,7 +442,7 @@ time_t FidoTimeToUnix(char* ptr) {
t.tm_sec = second; t.tm_sec = second;
t.tm_isdst = -1; t.tm_isdst = -1;
time_t a = mktime(&t); time_t a = mktime(&t);
struct tm *tp = gmtime(&a); struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1; tp->tm_isdst = -1;
time_t b = mktime(tp); time_t b = mktime(tp);
return a + a - b; return a + a - b;
@ -462,7 +455,7 @@ time_t FidoTimeToUnix(char* ptr) {
char* TimeToStr(char* buf, time_t t) { 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) { if(__msg->arrived == 0) {
time_t a = time(NULL); time_t a = time(NULL);
struct tm *tp = gmtime(&a); struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1; tp->tm_isdst = -1;
time_t b = mktime(tp); time_t b = mktime(tp);
__msg->arrived = a + a - b; __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.written = TimeToFTime(__msg->written);
__hdr.opus.arrived = TimeToFTime(__msg->arrived); __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", sprintf(__hdr.datetime, "%02d %3s %02d %02d:%02d:%02d",
_tm->tm_mday, gmonths[_tm->tm_mon+1], _tm->tm_year % 100, _tm->tm_mday, gmonths[_tm->tm_mon+1], _tm->tm_year % 100,
_tm->tm_hour, _tm->tm_min, _tm->tm_sec _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_sec = 0;
_tm.tm_isdst = -1; _tm.tm_isdst = -1;
time_t a = mktime(&_tm); time_t a = mktime(&_tm);
struct tm *tp = gmtime(&a); struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1; tp->tm_isdst = -1;
time_t b = mktime(tp); time_t b = mktime(tp);
__msg->written = a + a - b; __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.replyto = (msgn_t)__msg->link.to();
__hdr.reply1st = (msgn_t)__msg->link.first(); __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.date, 9, "%m-%d-%y", _tmp));
strc2p(strftimei(__hdr.time, 6, "%H:%M", _tmp)); strc2p(strftimei(__hdr.time, 6, "%H:%M", _tmp));

View File

@ -153,7 +153,7 @@ void JamArea::open_area() {
// Initialize header info // Initialize header info
memcpy(data->hdrinfo.signature, JAM_SIGNATURE, 4); memcpy(data->hdrinfo.signature, JAM_SIGNATURE, 4);
time_t a = time(NULL); time_t a = time(NULL);
struct tm *tp = gmtime(&a); struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1; tp->tm_isdst = -1;
time_t b = mktime(tp); time_t b = mktime(tp);
data->hdrinfo.datecreated = a + a - b; 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_sec = 0;
_tm.tm_isdst = -1; _tm.tm_isdst = -1;
time_t a = mktime(&_tm); time_t a = mktime(&_tm);
struct tm *tp = gmtime(&a); struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1; tp->tm_isdst = -1;
time_t b = mktime(tp); time_t b = mktime(tp);
__msg->written = a + a - b; __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 // Convert dates and times
char _dtbuf[9]; 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.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); 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); _idx.date = (word)YMD2JDN(1900+_tm->tm_year, _tm->tm_mon+1, _tm->tm_mday);
if(__msg->link.first()) { if(__msg->link.first()) {
__hdr.hasreply = 'R'; __hdr.hasreply = 'R';
_tm = gmtime(&__msg->pcboard.reply_written); _tm = ggmtime(&__msg->pcboard.reply_written);
int _year = _tm->tm_year % 100; int _year = _tm->tm_year % 100;
__hdr.replydate = L2B((10000L*_year) + (100L*(_tm->tm_mon+1)) + _tm->tm_mday); __hdr.replydate = L2B((10000L*_year) + (100L*(_tm->tm_mon+1)) + _tm->tm_mday);
memcpy(__hdr.replytime, strftimei(_dtbuf, 6, "%H:%M", _tm), 5); 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); __msg->attr.tfs(smsgp->hdr.auxattr & MSG_TRUNCFILE);
time_t a = smsgp->hdr.when_written.time; time_t a = smsgp->hdr.when_written.time;
struct tm *tp = gmtime(&a); struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1; tp->tm_isdst = -1;
time_t b = mktime(tp); time_t b = mktime(tp);
__msg->written = a + a - b; __msg->written = a + a - b;
a = smsgp->hdr.when_imported.time; a = smsgp->hdr.when_imported.time;
b = mktime(gmtime(&a)); b = mktime(ggmtime(&a));
__msg->arrived = a + a - b; __msg->arrived = a + a - b;
__msg->received = 0; __msg->received = 0;
@ -536,7 +536,7 @@ void SMBArea::save_hdr(int mode, gmsg* msg)
else { else {
memcpy(smsg.hdr.id, "SHD\x1a", 4); memcpy(smsg.hdr.id, "SHD\x1a", 4);
smsg.hdr.version = smb_ver(); smsg.hdr.version = smb_ver();
struct tm *tp = gmtime(&msg->written); struct tm *tp = ggmtime(&msg->written);
tp->tm_isdst = -1; tp->tm_isdst = -1;
smsg.hdr.when_written.time = mktime(tp); 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_written = TimeToFTime(__msg->written);
__hdr.date_arrived = TimeToFTime(__msg->arrived); __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", sprintf(__hdr.ftsc_date, "%02d %3s %02d %02d:%02d:%02d",
_tm->tm_mday, gmonths[_tm->tm_mon+1], _tm->tm_year % 100, _tm->tm_mday, gmonths[_tm->tm_mon+1], _tm->tm_year % 100,
_tm->tm_hour, _tm->tm_min, _tm->tm_sec _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_sec = _second;
_tm.tm_isdst = -1; _tm.tm_isdst = -1;
time_t a = mktime(&_tm); time_t a = mktime(&_tm);
struct tm *tp = gmtime(&a); struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1; tp->tm_isdst = -1;
time_t b = mktime(tp); time_t b = mktime(tp);
__msg->written = a + a - b; __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_sec = _second;
_tm.tm_isdst = -1; _tm.tm_isdst = -1;
time_t a = mktime(&_tm); time_t a = mktime(&_tm);
struct tm *tp = gmtime(&a); struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1; tp->tm_isdst = -1;
time_t b = mktime(tp); time_t b = mktime(tp);
__msg->received = a + a - b; __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)); strc2p(strcpy(__hdr.network, __msg->wildcat.network));
if(__msg->written) { 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.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; __hdr.msgtime = ((_tm->tm_hour*3600L)+(_tm->tm_min*60L)+_tm->tm_sec)+1;
} }
if(__msg->received) { 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.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; __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, "DestUserID : %i", _hdr.touserid);
AddLineF(line, "Subject : %s", STRNP2C(_hdr.subject)); AddLineF(line, "Subject : %s", STRNP2C(_hdr.subject));
AddLineF(line, "Network : %s", STRNP2C(_hdr.network)); 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, "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", gmtime(&msg->received)), _hdr.readdate, _hdr.readtime); 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, "mFlags : %u (%04Xh)", _hdr.mflags, _hdr.mflags);
AddLineF(line, "Reference : %u", _hdr.reference); 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); 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_hour = t.tm_min = t.tm_sec = 0;
t.tm_isdst = -1; t.tm_isdst = -1;
time_t a = mktime(&t); time_t a = mktime(&t);
struct tm *tp = gmtime(&a); struct tm *tp = ggmtime(&a);
tp->tm_isdst = -1; tp->tm_isdst = -1;
time_t b = mktime(tp); time_t b = mktime(tp);
__msg->arrived = a + a - b; __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.to, __msg->to, sizeof(__hdr.to));
strxcpy(__hdr.subj, __msg->re, sizeof(__hdr.subj)); 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", sprintf(__hdr.date, "%02d %3s %02d %02d:%02d:%02d",
_tm->tm_mday, gmonths[_tm->tm_mon+1], _tm->tm_year % 100, _tm->tm_mday, gmonths[_tm->tm_mon+1], _tm->tm_year % 100,
_tm->tm_hour, _tm->tm_min, _tm->tm_sec _tm->tm_hour, _tm->tm_min, _tm->tm_sec
); );
if(__msg->arrived) if(__msg->arrived)
_tm = gmtime(&__msg->arrived); _tm = ggmtime(&__msg->arrived);
__hdr.indate[0] = (byte)(_tm->tm_year - 89); __hdr.indate[0] = (byte)(_tm->tm_year - 89);
__hdr.indate[1] = (byte)(_tm->tm_mon + 1); __hdr.indate[1] = (byte)(_tm->tm_mon + 1);
__hdr.indate[2] = (byte)(_tm->tm_mday); __hdr.indate[2] = (byte)(_tm->tm_mday);