|
From: Tor L. <tm...@ik...> - 2005-01-21 10:08:08
|
Ilana Loubser writes:
> In SVR2, the TZ variable had to be a three-letter time zone,
> followed by a number representing the difference between local time
> and Greenwich Mean Time in hours, followed by an optional
> three-letter name for a daylight time zone;"
Yep, that's how it is in Microsoft's C library, too. (Which mingw uses
by definition; that is what mingw *is*, a development environment for
code that will use Microsoft's C library).
> when the optional daylight time zone is present, "standard U.S.A.
> Daylight Savings Time conversion is applied." This means that SVR2
> cannot handle other (for example, Australian) daylight savings time
> rules, or situations where more than two time zone abbreviations
> are used in an area.
=20
I am not quite sure how the Microsoft C library handles that. Hmm,
reading the source code (in the Platform SDK) seems to indicate that
if you have a TZ environment variable, is does use the US rules, with
no way to get around this. But if you don't have any TZ environment
variable (this is, after all, the normal case on Windows), the C
library uses the Windows API to handle DST rules, which takes the
user's Regional Settings into account and uses the correct rules (one
would hope).
> I am uncertain as to how mingw libraries work (whether it is e.g. a
> layer on top of the microsoft libraries),
There is very little of "mingw libraries". There is the libmingwex
("mingw extensions" library), but nothing in it related to time or
timezones. So it's not really a layer on top of the Microsoft C
library and API, a mingw-built program *uses* the Microsoft C
library. (Plus a small number of additions, like opendir() etc and
some mathematical functions, from libmingwex.)
> but it appears as if only the old method (three-letter time zone)
> of setting TZ is supported. =A0Does anyone know of a workaround for
> this problem?
Get suitable code for timezone handling and include in your code?
Would for example the original public domain Olson code be portable to
Windows? Or use the Win32 API directly and forget the TZ environment
variable and the C library's local time related functions.
Or try Cygwin? Does Cygwin implement full-fledged modern Unix-like
timezone stuff?
Or try the "libgw32c" library from the gnuwin32 project
(gnuwin32.sourceforge.net). (Don't assume the "gnuwin32" name means
"GNU on Win32", they aren't as far as I know in any way affiliated
with the FSF, and most of what they provide has nothing to do with the
FSF or GNU).
--tml
|