Jump to content

Recommended Posts

Posted

Hello,

I'm facing some trouble with the function _Date_Time_GetTimeZoneInformation() after last sunday the summer time (Daylight Savings Time) has ended for my timezone.

Help File for

Returns an array with the following format:
[0] - Daylight savings setting. Can be one of the following:
-1 - Failure
0 - Daylight savings time is not used in the current time zone
1 - Daylight savings time operating with standard time
2 - Daylight savings time operating with daylight savings time

[1] - The current bias for local time translation on this computer.
The bias is the difference in minutes between Coordinated Universal Time (UTC) and local time.
All translations between UTC and local time use the following formula: UTC = local time + bias

[2] - The description for standard time

[3] - A $tagSYSTEMTIME structure that contains a date and local time when the transition from daylight saving time to standard time occurs.

[4] - The bias value to be used during local time translations that occur during standard time.
This value is added to the value of the Bias to form the bias used during standard time.
In most time zones, this value is zero.

[5] - The description for daylight saving time

[6] - A $tagSYSTEMTIME structure that contains a date and local time when the transition from standard time to daylight saving time occurs.

[7] - The bias value to be used during local time translations that occur during daylight saving time.
This value is added to the value of the Bias member to form the bias used during daylight saving time. In most time zones this value is –60.

for most Windows installations the switching for summer / winter time is set to "automatically switch...", so it's for the box, that's giving the trouble right now.

 

The result array seems to just show, what the values are for "this time zone" and the additional offset for "DST", if I get it correctly, but *NOT* wether DST is currently *ACTIVE OR NOT*, isn't it?

 

So howto *DETECT*, if DST is currently active or not?

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Posted (edited)
4 hours ago, rudi said:

[0] - Daylight savings setting. Can be one of the following:
    -1 - Failure
    0 - Daylight savings time is not used in the current time zone
    1 - Daylight savings time operating with standard time
    2 - Daylight savings time operating with daylight savings time

@rudi

The function, upon success, returns an array.  The first item in the array, [0], tells you the current DST setting.

 

When I execute the following snippet, I get [0] = 2.  That means that my OS is using DST.

Which part of that did you not understand?  Or am I misunderstanding your question?

#include <Date.au3>
#include <Array.au3>

example()

Func example()
    _ArrayDisplay(_Date_Time_GetTimeZoneInformation())
EndFunc

Result:

image.png.d3ad69e8b47e1f62a686cf949b6c6657.png

Edited by TheXman
Posted

@TheXman

thanks for your reply. Hm.

I did read that, but assumed, that this is a description of the definitions of the selected time zone, and not of the current DST operating status of a given PC:

 

0 - Daylight savings time is not used in the current time zone
1 - Daylight savings time operating with standard time
2 - Daylight savings time operating with daylight savings time

 

But a Windows PC can 'make use' of these settings (Checkbox "Automatically adjust local time for DST"), and the switch between summer / winter time may fail. The [0] value currently is 1, that's right, I'm wondering, if it has been 2 before, or if this array just describes, how it *SHOULD* be...

And the autoadjustment might fail, too, or might not happen at the appropriate time.

 

 

Tomorrow I'll setup some box with a wrong date & time, some date in September to see, if the value then is 2. Then one just before "march sunday last", with "unchecked autoadjustment for DST", to see what's going on then.

 

Regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...