* KMail time
@ 1998-10-18 17:09 Stefan Katzenbeisser
1998-10-18 18:21 ` Michal Jaegermann
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Katzenbeisser @ 1998-10-18 17:09 UTC (permalink / raw)
To: axp-list
I just investigated the kMail time problem (sometimes it prints 48409
as the current year). This seems to be some strange gmtime() problem.
kMail executes the routine _FromUnixTime from the MIMELIB (datetime.cpp)
twice when it starts up (don't ask me why...)
void DwDateTime::_FromUnixTime(DwUint32 aTime)
{
printf("Executing _FromUnixTime with %d\n", aTime);
DwUint32 t = aTime + mZone*60;
#if defined(USE_PORTABLE_GMTIME)
struct tm tt;
my_gmtime_r(&t, &tt);
#elif defined(HAVE_GMTIME_R)
struct tm tt;
gmtime_r(&t, &tt);
#else
printf("gmtime called with %d\n", t);
struct tm tt = *gmtime((time_t*)&t);
#endif
mYear = tt.tm_year + 1900;
mMonth = tt.tm_mon + 1;
mDay = tt.tm_mday;
mHour = tt.tm_hour;
mMinute = tt.tm_min;
mSecond = tt.tm_sec;
printf("Result: %d\n", mYear);
}
This is the output when kMail starts up:
Executing _FromUnixTime with 908730326
gmtime called with 908737526
Result: 1998
Executing _FromUnixTime with 908730326
gmtime called with 908737526
Result: 48409
gmtime() gives two *different* results????
In order to avoid that problem, recompile MIMELIB with the
-DUSE_PORTABLE_GMTIME option and recompile KDE. kMail works fine
then.
Best,
S.K.
--
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
| Stefan Katzenbeisser
| e-mail: skatzenbeisser@acm.org
| http://stud3.tuwien.ac.at/~e9625414/
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
Public PGP key available on my homepage or upon request.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: KMail time
1998-10-18 17:09 KMail time Stefan Katzenbeisser
@ 1998-10-18 18:21 ` Michal Jaegermann
0 siblings, 0 replies; 2+ messages in thread
From: Michal Jaegermann @ 1998-10-18 18:21 UTC (permalink / raw)
To: axp-list
Stefan Katzenbeisser wrote:
>
> I just investigated the kMail time problem (sometimes it prints 48409
> as the current year). This seems to be some strange gmtime() problem.
It looks to me rather as an ordinary bug in KDE. One would think
that in this time and age they would know better.
> DwUint32 t = aTime + mZone*60;
^^^^^
> gmtime_r(&t, &tt);
^^^^
Library headers give:
extern struct tm *gmtime_r __P ((__const time_t *__timer,
struct tm *__tp));
time_t is not 32-bit wide nor guaranteed to be. Who knows what compiler
is doing with that. Basically you are passing an address "in vicinity"
and you are getting a garbage. Not surprising at all. my_gmtime_r()
has an opportunity to hide such bogus programming - although maybe is
just lucky.
It looks from the above that KDE will suffer from "2038 year bug";
even on 64-bit platforms.
--mj
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1998-10-18 18:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-10-18 17:09 KMail time Stefan Katzenbeisser
1998-10-18 18:21 ` Michal Jaegermann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox