Re: [HACKERS] Date/time on glibc2 linux
От | Oleg Broytmann |
---|---|
Тема | Re: [HACKERS] Date/time on glibc2 linux |
Дата | |
Msg-id | Pine.SOL2.3.96.SK.981209212753.9319A-100000@sun.med.ru обсуждение исходный текст |
Ответ на | Re: [HACKERS] Date/time on glibc2 linux ("Thomas G. Lockhart" <lockhart@alumni.caltech.edu>) |
Список | pgsql-hackers |
Hi! On Wed, 9 Dec 1998, Thomas G. Lockhart wrote: > > Another problem I have - I cannot recompile postgres with DATEDEBUG > > defined in config.h - I got the error: > <snip> > > These don't appear to be related. However, I usually just (slightly) I am sure this is related. When I edited config.h and commented out DATEDEBUG the sources compiled just fine. > edit the src/backend/utils/adt/Makefile to add in > CFLAGS+= -DDATEDEBUG Well, I'll try this. > since it is a symbol which afaik only affects files in that directory, > and should not be kept in after you are finished. > Do you have any test cases *other* than the date->datetime conversion > example? If you don't then we should probably be looking for a very > local problem, not a system-wide problem. otoh I have a hard time > picturing how this could not be a system-wide problem, given that I see > no problems on the same test case on gcc/libc5 systems. Any use for daylight or tzname or timezone (global vars) produces incorrect results. Again, test program is very simple: #include <stdio.h> #include <stdlib.h> #include <time.h> int main(int argc, char **argv) { char strf_buf[100]; time_t today_t; struct tm * today; memset(strf_buf, 0, 99); today_t = time(NULL); today = localtime(&today_t); strftime(strf_buf, 100, "%Z", today); printf("%s\n",strf_buf); /* In Moscow I expect MSK/MSD/1/10800 */ printf("%s\n%s\n%d\n%ld\n", tzname[0], tzname[1], daylight, timezone); return 0; } It looks like glibc2 defines these vars incorrectly. Correct values are in struct tm (including tmzone and gmtoff). Do you think it is local problem? I am pretty sure it is "system-wide". Oleg. ---- Oleg Broytmann National Research Surgery Centre http://sun.med.ru/~phd/ Programmers don't die, they justGOSUB without RETURN.
В списке pgsql-hackers по дате отправления: