Creating time object of a non local timezone
-
"SystemTimeToTzSpecificLocalTime" Windows Platform SDK call seems to satisy what i want to do. But again to populate the _TIME_ZONE_INFORMATION struct is a problem. Generally it is populated from the local TimeZone (Environment variable). Any Hints/Help to populate this struct with a non-local Timezone data. BOOL SystemTimeToTzSpecificLocalTime( LPTIME_ZONE_INFORMATION lpTimeZone, LPSYSTEMTIME lpUniversalTime, LPSYSTEMTIME lpLocalTime ); typedef struct _TIME_ZONE_INFORMATION { LONG Bias; WCHAR StandardName[32]; SYSTEMTIME StandardDate; LONG StandardBias; WCHAR DaylightName[32]; SYSTEMTIME DaylightDate; LONG DaylightBias; } TIME_ZONE_INFORMATION, *PTIME_ZONE_INFORMATION; Also i was wondering if anybody has seen the MultiTimeZone Clock Screen Saver. If the source code of that could be got it would make life simpler. Dimple
-
"SystemTimeToTzSpecificLocalTime" Windows Platform SDK call seems to satisy what i want to do. But again to populate the _TIME_ZONE_INFORMATION struct is a problem. Generally it is populated from the local TimeZone (Environment variable). Any Hints/Help to populate this struct with a non-local Timezone data. BOOL SystemTimeToTzSpecificLocalTime( LPTIME_ZONE_INFORMATION lpTimeZone, LPSYSTEMTIME lpUniversalTime, LPSYSTEMTIME lpLocalTime ); typedef struct _TIME_ZONE_INFORMATION { LONG Bias; WCHAR StandardName[32]; SYSTEMTIME StandardDate; LONG StandardBias; WCHAR DaylightName[32]; SYSTEMTIME DaylightDate; LONG DaylightBias; } TIME_ZONE_INFORMATION, *PTIME_ZONE_INFORMATION; Also i was wondering if anybody has seen the MultiTimeZone Clock Screen Saver. If the source code of that could be got it would make life simpler. Dimple
DimpleSurana wrote: Any Hints/Help to populate this struct with a non-local Timezone data. I live in GMT-0600, which is known as CST here in the U.S. If I wanted the time for EST, or GMT-0500, I would do something like:
TIME_ZONE_INFORMATION tzi = {0};
SYSTEMTIME stUniversal = {0},
stLocal = {0};tzi.Bias = 300;
GetSystemTime(&stUniversal); // 16:06 GMT
SystemTimeToTzSpecificLocalTime(&tzi, &stUniversal, &stLocal); // 11:06 EST
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
-
DimpleSurana wrote: Any Hints/Help to populate this struct with a non-local Timezone data. I live in GMT-0600, which is known as CST here in the U.S. If I wanted the time for EST, or GMT-0500, I would do something like:
TIME_ZONE_INFORMATION tzi = {0};
SYSTEMTIME stUniversal = {0},
stLocal = {0};tzi.Bias = 300;
GetSystemTime(&stUniversal); // 16:06 GMT
SystemTimeToTzSpecificLocalTime(&tzi, &stUniversal, &stLocal); // 11:06 EST
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
Hi David, I really appreciate the code snippets you give me. But i wanted to know that how do i add DST information to it too. For eg. EST timezone see's DST. I idea is that "stLocal" will be given its TimeZone only once & hence forth onwards it should always know its TimeZone's Time including DST. Thanks, Dimple
-
Hi David, I really appreciate the code snippets you give me. But i wanted to know that how do i add DST information to it too. For eg. EST timezone see's DST. I idea is that "stLocal" will be given its TimeZone only once & hence forth onwards it should always know its TimeZone's Time including DST. Thanks, Dimple
Check out the
DaylightBias
member of theTIME_ZONE_INFORMATION
structure.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
-
Check out the
DaylightBias
member of theTIME_ZONE_INFORMATION
structure.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
Do u have ne generic solution that will update the time object based on the incoming timezone. This is gonna require some manual programming i believe so was loking otu for a code snippet. Dimple
-
Do u have ne generic solution that will update the time object based on the incoming timezone. This is gonna require some manual programming i believe so was loking otu for a code snippet. Dimple
Nothing that revolves around a "timezone identifier." Otherwise, the
DaylightBias
andBias
members should solve your problem.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)