Hi Peter,
I haven't written anything like that (especially not in VB since I'm C++), but I think
that one way to go is to use win32 API's.
There are at least two ways of doing it, as usual on e quicker and dirtier and another
heavier and more robust:
Quick and Dirty:
Call GetLocalTime() and GetSystemTime and calculate the difference between the two and
then add or subtract that value from your PutDateTime-property.
Observe that these Api's uses a Win32 SYSTEMTIME-struct, that you have to define
yourself in VB (shouldn't be so hard, I Hope).
Heavier and more Robust:
1. Call SystemTimeToFileTime() with your PutDateTime-property expressed as a Win32
SYSTEMTIME-struct, gives you a Win32 FILETIME-struct
2. Call FileTimeToLocalFileTime() with the received Win32 FILETIME-struct in step 1,
which gives you a new Win32 FILETIME-struct.
3. Call FileTimeToSystemTime() with the received Win32 FILETIME-struct in step 2,
which gives you a Win32 SYSTEMTIME-struct representing your PutDateTime-property
formatted as a SYSTEMTIME-struct (in
LocalTime) which is a nice format to continue with.
Observe that these Api's uses Win32 SYSTEMTIME and FILETIME -struct's, that you have
to define yourself in VB (shouldn't be so hard, I Hope).
The second alternative is what I would go for if I were going to write such a GMT to
local time converter in C++ !
It should also handle cases when messages were placed on the queue just before the DST
(Daylight Savings Time) switch occurred and you're reading them afterwards, then
you're going calculate the
actual local time when the message was placed on the queue, with the quick and dirty
solution you're actually calculating the wrong time in that case....
Hope this Helps !!
Regards,
Peter Larsson
Peter Heggie
<Peter.Heggie@US. To: [EMAIL PROTECTED]
NGRID.COM> cc:
Sent by: MQSeries Subject: VB and message.PutDateTime
w/GMT
List
<MQSERIES@AKH-WIE
N.AC.AT>
2002-07-11 21:09
Please respond to
MQSeries List
How can a VB program account for GMT in the message object's PutDateTime
property? On the mainframe there are functions I can call that tell me if
GMT is observed, and if so, what is the offset..
On Windows, using VB COM components, the message PutDateTime property
returns the time using GMT. I could just hardcode a value to subtract to
get the local time, but then when switching to or from Daylight Savings
Time, the hardcoded value would be wrong.
Has anyone developed a way to compensate for GMT?
I could just write a quick, non-persistent message with a short expiry, and
read it back in to the program and compare the current time with the
PutDateTime to get the offset, but that seems like overkill (and too much
overhead)..
Peter
Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://vm.akh-wien.ac.at/MQSeries.archive
Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://vm.akh-wien.ac.at/MQSeries.archive