Subj : Re: Date problem To : netscape.public.mozilla.jseng From : Shanti Rao Date : Mon Apr 12 2004 05:42 pm There was a subtle solution. The macro JSLL_INIT in jslong.h seems to give the wrong value occasionally if your compiler has a native __int64 type. Here's a demonstartion that compiles with GCC on Windows. It will print out two lines, the first with a correct JS date code, the second 369 years in the future. --------- #include "windows.h" #include "stdio.h" int main(int, char**) { FILETIME time; __int64 a,b,s,us; char t[128]; GetSystemTimeAsFileTime(&time); us = (__int64)(time.dwLowDateTime); s = (__int64)(time.dwHighDateTime); a = (s << 32) + us; a = a - (((__int64)0x19db1de << 32) + 0xd53e8000); a = a / 10000; _i64toa(a, t, 10); puts(t); b = (s << 32) + us; b = b - ((0x19db1de << 32) + 0xd53e8000); b = b / 10000; _i64toa(b, t, 10); puts(t); return 0; } -------- The simple workaround is to make a change to lines 321ff of prmjtime.c #ifdef XP_WIN JSInt64 s, us, /*win2un = JSLL_INIT(0x19DB1DE, 0xD53E8000),*/ win2un = (__int64)0x19DB1DE << 32 + 0xD53E8000, ten = JSLL_INIT(0, 10); FILETIME time, midnight; #endif The macro JSLL_INIT is used three other times in jslong.c. Similar modifications are obvious. Hope that helps somebody else, Shanti .