Mármint AIX-on nem, ott a '%z' ugyanazt csinálja, mint a '%Z' (CET/CEST/MSK, ilyesmik).
No mindegy, a gond nem is ez, hanem a manualnak ez az apró bejegyzése:
Attention: Do not use the tzset subroutine when linking with both libc.a and libbsd.a. The tzset subroutine sets the global external variable called timezone, which conflicts with the timezone subroutine in libbsd.a. This name collision may cause unpredictable results.
Ez magában foglalja azt is, hogy a `timezone` változóra nem építhetek, hacsak nem látok a jövőbe, és nem garantálom, hogy ki, mikor, hogyan, hová fogja belinkelni azt a programrészt, amit most tákolok. Szóval egy jó kis platformfüggő #ifdef elágazás lesz ebből; érdekességképpen a diagnosztika program kimenete egy AIX-os gépen:
=== strftime %z %Z === utc: 20200415.094201.CET.CET local: 20200415.114201.CEST.CEST === global variables === timezone=-3600 daylight=1 tzname=(CET,CEST) AIX: 'timezone' cannot be used if linked with '-lbsd'. Basically, it means 'timezone' cannot be safely used. === fields of 'struct tm' === tm_isdst=1 AIX: 'tm_gmtoff' and 'tm_zone' don't exist in AIX === fields of 'struct timeb' === timezone=-60 dstflag=1 POSIX: 'ftime' and 'struct timeb' shouldn't be used, and/or these fields might be unset Linux: (if filled) these fields contain some system-global setting (TZ-independent) AIX: these fields contain TZ-dependent values === fields of 'struct tz' === tz_minuteswest=-60 tz_dsttime=1 POSIX: 'gettimeofday' shouldn't be used, especially its 'timezone' parameter Linux: (if filled) these fields contain some system-global setting (TZ-independent) AIX: these fields contain TZ-dependent values
- NevemTeve blogja
- A hozzászóláshoz be kell jelentkezni
- 121 megtekintés