Issues w/ POSIX's strftime() ?

Philip Prindeville <[email protected]> Fri, 14 Sep 2012 19:12:00 -0600
Newsgroups gmane.comp.lang.perl.active-perl
Message-ID <[email protected]>
I tried to use strftime() with '%T' and it fails... but works when I use '%H:%M:%S' instead. Is this a known issue?

Also, '%Z' is supposed to give the time zone name or abbreviation, but '%z' is supposed to give the time zone offset as +/-hhmm.

However, I just tried, and '%z' and '%Z' yield identical results.

I'm thinking that under Win32, %Z (and %z) should be formatted via:

TIME_ZONE_INFORMATION tzinfo;
DWORD ret = GetTimeZoneInformation(&tzinfo);

if (ret == 2) {
  strcpy(tzName, tzinfo.DaylightName);
} else {
  strcpy(tzName, tzinfo.StandardName);
}

sprintf(tzOffset, "%c%02d%02d", (tzinfo.Bias < 0 ? '-' : '+'), abs(tzinfo.Bias) / 60, abs(tzinfo.Bias) % 60);

What am I missing?

-Philip
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs