Home All Groups Group Topic Archive Search About

Changind TimeZone and notification without application restart

Author
7 Feb 2007 1:55 PM
Peri
My app reads serialized DataTable containing DateTime columns. The file =
=

can be moved between machines with different Time Zones. When I read  =

serialized DataTable on machine with different Time Zone (machine B) tha=
n  =

machine the DataTable was serialized on (machine A) I have to switch  =

TimeZone to same as that on machine A. Otherwise the DateTime columns ar=
e  =

converted to local time, and I don't want that. If I'm in GMT + 1 and  =

serialize DateTime column it is written like this:
2007-01-24T00:00:00+01:00. When I deserialize it on machine B with GMT +=
0  =

it is converted to 2007-01-23T23:00:00+00:00.

I've found way to change time zones. But I can't find a way to inform my=
  =

app (the same that is changing time zone) that time zone has changed. An=
d  =

altought Time Zone is changed to GMT + 1 deserializing works like in GMT=
  =

+ 0. When I restart application it works ok. But I need to be able to  =

deserialize it using the TimeZone I switched to withour restarting my ap=
p.  =

I've tried:

uint msg =3D RegisterWindowMessage("WM_SETTINGCHANGE");
IntPtr HWND_BROADCAST =3D new IntPtr(0xffff);
IntPtr res;
IntPtr res2 =3D SendMessageTimeout(HWND_BROADCAST, msg, IntPtr.Zero,  =

IntPtr.Zero, SendMessageTimeoutFlags.SMTO_NORMAL, 1000, out res)

, but with no success.



-- =

Peri

Author
7 Feb 2007 6:01 PM
Ollie Riches
As you probably know by now that TimeZones on the DateTime structure is not
supported in the current vesion 1.0 - 2.0 of the framework but 'should' be
supported in the future, check out the blog

http://blogs.msdn.com/kathykam/archive/2006/07/27/680593.aspx

HTH

Ollie Riches
"Peri" <em***@server.net> wrote in message
news:op.tndsy7nnm2t6na@at-piotrpe.atena.pl...
My app reads serialized DataTable containing DateTime columns. The file
can be moved between machines with different Time Zones. When I read
serialized DataTable on machine with different Time Zone (machine B) than
machine the DataTable was serialized on (machine A) I have to switch
TimeZone to same as that on machine A. Otherwise the DateTime columns are
converted to local time, and I don't want that. If I'm in GMT + 1 and
serialize DateTime column it is written like this:
2007-01-24T00:00:00+01:00. When I deserialize it on machine B with GMT + 0
it is converted to 2007-01-23T23:00:00+00:00.

I've found way to change time zones. But I can't find a way to inform my
app (the same that is changing time zone) that time zone has changed. And
altought Time Zone is changed to GMT + 1 deserializing works like in GMT
+ 0. When I restart application it works ok. But I need to be able to
deserialize it using the TimeZone I switched to withour restarting my app.
I've tried:

uint msg = RegisterWindowMessage("WM_SETTINGCHANGE");
IntPtr HWND_BROADCAST = new IntPtr(0xffff);
IntPtr res;
IntPtr res2 = SendMessageTimeout(HWND_BROADCAST, msg, IntPtr.Zero,
IntPtr.Zero, SendMessageTimeoutFlags.SMTO_NORMAL, 1000, out res)

, but with no success.



--
Peri
Author
8 Feb 2007 8:13 AM
Peri
On Wed, 07 Feb 2007 19:01:36 +0100, Ollie Riches 
<ollie_ric***@hotmail.com> wrote:

> As you probably know by now that TimeZones on the DateTime structure is 
> not
> supported in the current vesion 1.0 - 2.0 of the framework but 'should' 
> be
> supported in the future, check out the blog
>
> http://blogs.msdn.com/kathykam/archive/2006/07/27/680593.aspx
>

So You think restarting application is the only way?
--
Peri

AddThis Social Bookmark Button