Inconsistent time zone

  • Thread starter Swansea University Psychology
  • Start date
S

Swansea University Psychology

Hi all,

I have a utility that uses the C library function strftime() to return the
time zone name, but it returns "GMT Standard Time" on one computer, and
"BST" (which it should be at the moment) on the other computer.

Both PCs are Windows XP Pro Service Pack 2. Both have their time zone set to
GMT +0 (London). And in the Date & Time control panel applet, both show "GMT
Standard Time" as the Current time zone. Both have the correct date and time
values.

Can anyone suggest what's going wrong here?

Regards,
Neil
--------------------------------------------
Neil Carter Psychology Department
IT Technician University of Wales Swansea
Wales, United Kingdom

http://psy.swansea.ac.uk/staff/Carter/
 
A

Alex Nichol

Swansea said:
I have a utility that uses the C library function strftime() to return the
time zone name, but it returns "GMT Standard Time" on one computer, and
"BST" (which it should be at the moment) on the other computer.

Both PCs are Windows XP Pro Service Pack 2. Both have their time zone set to
GMT +0 (London). And in the Date & Time control panel applet, both show "GMT
Standard Time" as the Current time zone. Both have the correct date and time
values.

Does one have 'adjust for daylight saving' checked, and the other not
(but the clock set to the BST time value)?
 
N

Neil Carter

Neil Carter said:
Yup! Any other ideas?!

I managed to resolve this by unchecking the Automatically adjust option
checkbox in Date and Time properties (on the machine returning GMT Standard
Time), then clicking OK to close the dialog box, then going back into the
dialog box and rechecking the checkbox and clicking OK again. Strftime("%Z")
on that machine now returns GMT Daylight Time.

The strange thing is that strftime() on the other machine (this machine, in
fact) returns BST.

There are other puzzling things... This machine returns BST even though it
(incorrectly) shows GMT Standard Time in the Date and Time dialog box.

Also, when I turned off the auto-adjust option on the other machine, the
clock did not change its time, but when I tried it on this machine, it went
back one hour. Furthermore, since I tried the same uncheck-check procedure
on this machine, the dialog box now shows GMT Daylight Time, yet strftime()
still returns BST!

Weird.
Neil
--------------------------------------------
Neil Carter Psychology Department
IT Technician University of Wales Swansea
Wales, United Kingdom

http://psy.swansea.ac.uk/staff/Carter/
 
O

Old Wolf

Greenwich Mean Time Standard Time? What an odd thing to return

At least one of them says something useful..
I managed to resolve this by unchecking the Automatically adjust option
checkbox in Date and Time properties (on the machine returning GMT Standard
Time), then clicking OK to close the dialog box, then going back into the
dialog box and rechecking the checkbox and clicking OK again. Strftime("%Z")
on that machine now returns GMT Daylight Time.

There is no such thing as Greenwich Mean Time Daylight Time.
To quote from www.greenwichmeantime.com,

It is the same all year round and is not effected(sic)
by Summer Time or Daylight saving Time.

GMT is the mean (averaging out of minor variations over a year)
time that the sun crosses the Greenwich meridian. To suggest that
it changes for summer would be to suggest that the earth stops
rotating for an hour when the time kicks in, or something
equally absurd.
Also, when I turned off the auto-adjust option on the other machine, the
clock did not change its time, but when I tried it on this machine, it went
back one hour. Furthermore, since I tried the same uncheck-check procedure
on this machine, the dialog box now shows GMT Daylight Time, yet strftime()
still returns BST!

You are not the first person to be exasperated by the
behaviour of the Windows API. Probably a better place
to ask followup questions would be to a Windows
programming newsgroup, or a Windows XP group.
 
D

Dave Thompson

I have a utility that uses the C library function strftime() to return the
time zone name, but it returns "GMT Standard Time" on one computer, and
"BST" (which it should be at the moment) on the other computer.
Per followup, un&reticking "Adjust for DST" changed to "GMT Daylight".
Both PCs are Windows XP Pro Service Pack 2. Both have their time zone set to
GMT +0 (London). <snip>

What runtime are you using? E.g. is your program compiled with MSVC*
(uses M$ library -- static or dynamic?); mingw (_mostly_ M$ library);
cygwin (its own pseudo-Unix library); something else (?).

If the M$ library, does (only) the second system have an environment
variable TZ set, either globally (in Control Panel / System) or in the
process where your app is run (perhaps by a .BAT file)? At least in my
limited testing, that overrides the OS setting.

- David.Thompson1 at worldnet.att.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top