OpenNETCF.Win32.DateTimeEx.SetTimeZoneInformation

R

RDub

I am having a heck of a time setting the Time Zone in my app. I am using VS
2003 with OpenNETCF 1.4 and CF 1.0 on a Symbol MC50 running PPC 2003.

Here is a snip of the code I am using:

Dim tziInfo As New OpenNETCF.Win32.TimeZoneCollection

For Each tziItem As OpenNETCF.Win32.TimeZoneInformation In tziInfo
If tziItem.DisplayName = strTimeZoneDisplayName Then
' Set the TimeZone First
OpenNETCF.Win32.DateTimeEx.SetTimeZoneInformation(tziItem)

' Then Set the Universal Time
OpenNETCF.Win32.DateTimeEx.SetSystemTime(dteUTCDateTime)
Exit For
End If
Next

The code executes without error, however it is not setting the time zone to
the one I expected. For instance If strTimeZoneDisplayName contains "GMT-5
Eastern US" When I inspect the device after this code is run I see the Time
zone is set to "GMT-5 Indiana (USA)". If I select "GMT-6 Central US" I get
"GMT-6 Saskatchewan", and so on. It does however set the time correctly

I am sure that I am doing something wrong here for for the life of me I can
not see it. Can anyone shed some light on this for me? I am about to run
out of hair.

Ron W
 
P

Paul G. Tobey [eMVP]

Question #1: how are you initializing tziInfo? Seems like you should be
calling Initialize()...

Question #2: when the SetTimeZoneInformation line is about to be executed,
what are the values in the tziItem?

Paul T.
 
R

RDub

Paul, thanks for your response. I knew should have just pasted the entire
Sub. I have been playing with this for some time and have tried many
variations on the same theme, all of which have come back with the same
results. Here is what I am working with now.

Private Sub SetSystemDateTime(ByVal strTimeZoneDisplayName As String, _
ByVal dteUTCDateTime As DateTime)
' Purpose Set the time zone and the UTC time and date using the
pram's passed
Dim TZI As OpenNETCF.Win32.TimeZoneInformation = New
OpenNETCF.Win32.TimeZoneInformation
Dim TZS As OpenNETCF.Win32.TimeZoneState
Dim tziInfo As New OpenNETCF.Win32.TimeZoneCollection

tziInfo.Initialize()
' Iterate each time zone looking for the one that we want to use
For Each tziItem As OpenNETCF.Win32.TimeZoneInformation In tziInfo
txtTZIDescr.Text += tziItem.DisplayName & vbCrLf
If tziItem.DisplayName = strTimeZoneDisplayName Then
'TZI = tziItem
TZI.Bias = tziItem.Bias
TZI.DaylightBias = tziItem.DaylightBias
TZI.DaylightDate = tziItem.DaylightDate
TZI.DaylightName = tziItem.DaylightName
TZI.DisplayName = tziItem.DisplayName
TZI.StandardBias = tziItem.StandardBias
TZI.StandardDate = tziItem.StandardDate
TZI.StandardName = tziItem.StandardName

txtTZIDescr.Text += "TZI.Bias " & TZI.Bias & vbCrLf
txtTZIDescr.Text += "TZI.DaylightBias " & TZI.DaylightBias &
vbCrLf
txtTZIDescr.Text += "TZI.DaylightDate " &
TZI.DaylightDate.ToDateTime.ToString & vbCrLf
txtTZIDescr.Text += "TZI.DaylightName " & TZI.DaylightName &
vbCrLf
txtTZIDescr.Text += "TZI.DisplayName " & TZI.DisplayName &
vbCrLf
txtTZIDescr.Text += "TZI.StandardBias " & TZI.StandardBias &
vbCrLf
txtTZIDescr.Text += "TZI.StandardDate " &
TZI.StandardDate.ToDateTime.ToString & vbCrLf
txtTZIDescr.Text += "TZI.StandardName " & TZI.StandardName &
vbCrLf

' Set the TimeZone First
OpenNETCF.Win32.DateTimeEx.SetTimeZoneInformation(TZI)
TZS = OpenNETCF.Win32.DateTimeEx.GetTimeZoneInformation(TZI)
txtTZIDescr.Text += "Set Time Zone " & TZI.DisplayName &
vbCrLf
txtTZIDescr.Text += "Get TZI " & TZI.DisplayName & vbCrLf
txtTZIDescr.Text += "Get TZS " & TZS.ToString

' Then Set the GMT Time
OpenNETCF.Win32.DateTimeEx.SetSystemTime(dteUTCDateTime)
Exit For
End If
Next
End Sub

I am calling the sub with the following :

SetSystemDateTime("GMT-5 Eastern US", "06/05/2007 11:11:11 Am")

Revelant values that Printed in txtTZIDescr Text Box are:
....
GMT-6 Cent. America
GMT-5 Eastern US
TZI.Bias 300
TZI.DaylightBias -60
TZI.DaylightDate 1/1/0001 12:00:00 AM
TZI.DaylightName Eastern Daylight Ti
TZI.DisplayName GMT-5 Eastern US
TZI.StandardBias 0
TZI.StandardDate 1/1/0001 12:00:00 AM
TZI.StandardName Eastern Standard Ti
Set Time Zone GMT-5 Eastern US
Get TZI GMT-5 Eastern US
Get TZS Standard

The Dates look kinda fuggly, and the Daylight and standard names appear to
be truncated. Sure would appreciate any help you can provide.

Ron W


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
 
P

Paul G. Tobey [eMVP]

The standard date and daylight date items are not dates; they're indications
of when the transition between standard time and daylight time occurs. So,
for that time zone, daylight date would be 2am on the second Sunday of March
or something of that nature. So, you really can't use ToDateTime on it and
have the result make sense. It's a guess, but I'd say that there's probably
a bug in that conversion operation.

As for the display name, I really don't know. I suspect that, if you
stepped through the building of the collection and verified that you were
getting the right string back from the registry, having it put into the
collection item correctly, etc., you'd probably spot a problem there, but
reading the code, I don't see what it would be.

As for the error that you're reporting, I don't see any way that this can be
caused by the library. What gets passed to SetTimeZoneInformation() (the
API call), it just copied into some internal space where the shell and
everyone else gets it. It doesn't access the time zone list and add or
subtract one from some index or anything. The TIME_ZONE_INFORMATION
structure you pass doesn't even have to exist; you can completely make up
your own time zone. The only thing I can think of is that, somehow, you're
performing the SetTimeZoneInformation twice, once for the zone you want, and
once for the one you're ending up with...

Paul T.

RDub said:
Paul, thanks for your response. I knew should have just pasted the entire
Sub. I have been playing with this for some time and have tried many
variations on the same theme, all of which have come back with the same
results. Here is what I am working with now.

Private Sub SetSystemDateTime(ByVal strTimeZoneDisplayName As String, _
ByVal dteUTCDateTime As DateTime)
' Purpose Set the time zone and the UTC time and date using the
pram's passed
Dim TZI As OpenNETCF.Win32.TimeZoneInformation = New
OpenNETCF.Win32.TimeZoneInformation
Dim TZS As OpenNETCF.Win32.TimeZoneState
Dim tziInfo As New OpenNETCF.Win32.TimeZoneCollection

tziInfo.Initialize()
' Iterate each time zone looking for the one that we want to use
For Each tziItem As OpenNETCF.Win32.TimeZoneInformation In tziInfo
txtTZIDescr.Text += tziItem.DisplayName & vbCrLf
If tziItem.DisplayName = strTimeZoneDisplayName Then
'TZI = tziItem
TZI.Bias = tziItem.Bias
TZI.DaylightBias = tziItem.DaylightBias
TZI.DaylightDate = tziItem.DaylightDate
TZI.DaylightName = tziItem.DaylightName
TZI.DisplayName = tziItem.DisplayName
TZI.StandardBias = tziItem.StandardBias
TZI.StandardDate = tziItem.StandardDate
TZI.StandardName = tziItem.StandardName

txtTZIDescr.Text += "TZI.Bias " & TZI.Bias & vbCrLf
txtTZIDescr.Text += "TZI.DaylightBias " & TZI.DaylightBias
& vbCrLf
txtTZIDescr.Text += "TZI.DaylightDate " &
TZI.DaylightDate.ToDateTime.ToString & vbCrLf
txtTZIDescr.Text += "TZI.DaylightName " & TZI.DaylightName
& vbCrLf
txtTZIDescr.Text += "TZI.DisplayName " & TZI.DisplayName &
vbCrLf
txtTZIDescr.Text += "TZI.StandardBias " & TZI.StandardBias
& vbCrLf
txtTZIDescr.Text += "TZI.StandardDate " &
TZI.StandardDate.ToDateTime.ToString & vbCrLf
txtTZIDescr.Text += "TZI.StandardName " & TZI.StandardName
& vbCrLf

' Set the TimeZone First
OpenNETCF.Win32.DateTimeEx.SetTimeZoneInformation(TZI)
TZS =
OpenNETCF.Win32.DateTimeEx.GetTimeZoneInformation(TZI)
txtTZIDescr.Text += "Set Time Zone " & TZI.DisplayName &
vbCrLf
txtTZIDescr.Text += "Get TZI " & TZI.DisplayName & vbCrLf
txtTZIDescr.Text += "Get TZS " & TZS.ToString

' Then Set the GMT Time
OpenNETCF.Win32.DateTimeEx.SetSystemTime(dteUTCDateTime)
Exit For
End If
Next
End Sub

I am calling the sub with the following :

SetSystemDateTime("GMT-5 Eastern US", "06/05/2007 11:11:11 Am")

Revelant values that Printed in txtTZIDescr Text Box are:
...
GMT-6 Cent. America
GMT-5 Eastern US
TZI.Bias 300
TZI.DaylightBias -60
TZI.DaylightDate 1/1/0001 12:00:00 AM
TZI.DaylightName Eastern Daylight Ti
TZI.DisplayName GMT-5 Eastern US
TZI.StandardBias 0
TZI.StandardDate 1/1/0001 12:00:00 AM
TZI.StandardName Eastern Standard Ti
Set Time Zone GMT-5 Eastern US
Get TZI GMT-5 Eastern US
Get TZS Standard

The Dates look kinda fuggly, and the Daylight and standard names appear to
be truncated. Sure would appreciate any help you can provide.

Ron W


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
Question #1: how are you initializing tziInfo? Seems like you should be
calling Initialize()...

Question #2: when the SetTimeZoneInformation line is about to be
executed, what are the values in the tziItem?

Paul T.
 
R

Ron Weiner

Thanks for your help Paul.

I am pretty sure that I am not making the call twice as the project I am
testing this in contains one form with one button and one text box. The
OnClick event of the button has one line of code in it that calls the
SetSystemDateTime sub and that's the whole app.

If you are feeling ultra adventurous (or just wanted to take pity on me) you
could put the whole thing together in 5 minutes. In the meantime as I am
out of ideas for this solution and will look into attempting to wrap the
PInvokes and TZI structures up myself. I have little to loose, and it's yet
another chance to learn something. Might also get the folks at Symbol
involved. They have been helpful in the past.

Thanks again for your help.

Ron W

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:%[email protected]...
The standard date and daylight date items are not dates; they're
indications of when the transition between standard time and daylight time
occurs. So, for that time zone, daylight date would be 2am on the second
Sunday of March or something of that nature. So, you really can't use
ToDateTime on it and have the result make sense. It's a guess, but I'd
say that there's probably a bug in that conversion operation.

As for the display name, I really don't know. I suspect that, if you
stepped through the building of the collection and verified that you were
getting the right string back from the registry, having it put into the
collection item correctly, etc., you'd probably spot a problem there, but
reading the code, I don't see what it would be.

As for the error that you're reporting, I don't see any way that this can
be caused by the library. What gets passed to SetTimeZoneInformation()
(the API call), it just copied into some internal space where the shell
and everyone else gets it. It doesn't access the time zone list and add
or subtract one from some index or anything. The TIME_ZONE_INFORMATION
structure you pass doesn't even have to exist; you can completely make up
your own time zone. The only thing I can think of is that, somehow,
you're performing the SetTimeZoneInformation twice, once for the zone you
want, and once for the one you're ending up with...

Paul T.

RDub said:
Paul, thanks for your response. I knew should have just pasted the
entire Sub. I have been playing with this for some time and have tried
many variations on the same theme, all of which have come back with the
same results. Here is what I am working with now.

Private Sub SetSystemDateTime(ByVal strTimeZoneDisplayName As String,
_
ByVal dteUTCDateTime As DateTime)
' Purpose Set the time zone and the UTC time and date using the
pram's passed
Dim TZI As OpenNETCF.Win32.TimeZoneInformation = New
OpenNETCF.Win32.TimeZoneInformation
Dim TZS As OpenNETCF.Win32.TimeZoneState
Dim tziInfo As New OpenNETCF.Win32.TimeZoneCollection

tziInfo.Initialize()
' Iterate each time zone looking for the one that we want to use
For Each tziItem As OpenNETCF.Win32.TimeZoneInformation In tziInfo
txtTZIDescr.Text += tziItem.DisplayName & vbCrLf
If tziItem.DisplayName = strTimeZoneDisplayName Then
'TZI = tziItem
TZI.Bias = tziItem.Bias
TZI.DaylightBias = tziItem.DaylightBias
TZI.DaylightDate = tziItem.DaylightDate
TZI.DaylightName = tziItem.DaylightName
TZI.DisplayName = tziItem.DisplayName
TZI.StandardBias = tziItem.StandardBias
TZI.StandardDate = tziItem.StandardDate
TZI.StandardName = tziItem.StandardName

txtTZIDescr.Text += "TZI.Bias " & TZI.Bias & vbCrLf
txtTZIDescr.Text += "TZI.DaylightBias " & TZI.DaylightBias
& vbCrLf
txtTZIDescr.Text += "TZI.DaylightDate " &
TZI.DaylightDate.ToDateTime.ToString & vbCrLf
txtTZIDescr.Text += "TZI.DaylightName " & TZI.DaylightName
& vbCrLf
txtTZIDescr.Text += "TZI.DisplayName " & TZI.DisplayName &
vbCrLf
txtTZIDescr.Text += "TZI.StandardBias " & TZI.StandardBias
& vbCrLf
txtTZIDescr.Text += "TZI.StandardDate " &
TZI.StandardDate.ToDateTime.ToString & vbCrLf
txtTZIDescr.Text += "TZI.StandardName " & TZI.StandardName
& vbCrLf

' Set the TimeZone First
OpenNETCF.Win32.DateTimeEx.SetTimeZoneInformation(TZI)
TZS =
OpenNETCF.Win32.DateTimeEx.GetTimeZoneInformation(TZI)
txtTZIDescr.Text += "Set Time Zone " & TZI.DisplayName &
vbCrLf
txtTZIDescr.Text += "Get TZI " & TZI.DisplayName & vbCrLf
txtTZIDescr.Text += "Get TZS " & TZS.ToString

' Then Set the GMT Time
OpenNETCF.Win32.DateTimeEx.SetSystemTime(dteUTCDateTime)
Exit For
End If
Next
End Sub

I am calling the sub with the following :

SetSystemDateTime("GMT-5 Eastern US", "06/05/2007 11:11:11 Am")

Revelant values that Printed in txtTZIDescr Text Box are:
...
GMT-6 Cent. America
GMT-5 Eastern US
TZI.Bias 300
TZI.DaylightBias -60
TZI.DaylightDate 1/1/0001 12:00:00 AM
TZI.DaylightName Eastern Daylight Ti
TZI.DisplayName GMT-5 Eastern US
TZI.StandardBias 0
TZI.StandardDate 1/1/0001 12:00:00 AM
TZI.StandardName Eastern Standard Ti
Set Time Zone GMT-5 Eastern US
Get TZI GMT-5 Eastern US
Get TZS Standard

The Dates look kinda fuggly, and the Daylight and standard names appear
to be truncated. Sure would appreciate any help you can provide.

Ron W


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message news:[email protected]...
Question #1: how are you initializing tziInfo? Seems like you should be
calling Initialize()...

Question #2: when the SetTimeZoneInformation line is about to be
executed, what are the values in the tziItem?

Paul T.

I am having a heck of a time setting the Time Zone in my app. I am
using VS 2003 with OpenNETCF 1.4 and CF 1.0 on a Symbol MC50 running PPC
2003.

Here is a snip of the code I am using:

Dim tziInfo As New OpenNETCF.Win32.TimeZoneCollection

For Each tziItem As OpenNETCF.Win32.TimeZoneInformation In
tziInfo
If tziItem.DisplayName = strTimeZoneDisplayName Then
' Set the TimeZone First

OpenNETCF.Win32.DateTimeEx.SetTimeZoneInformation(tziItem)

' Then Set the Universal Time
OpenNETCF.Win32.DateTimeEx.SetSystemTime(dteUTCDateTime)
Exit For
End If
Next

The code executes without error, however it is not setting the time
zone to the one I expected. For instance If strTimeZoneDisplayName
contains "GMT-5 Eastern US" When I inspect the device after this code
is run I see the Time zone is set to "GMT-5 Indiana (USA)". If I
select "GMT-6 Central US" I get "GMT-6 Saskatchewan", and so on. It
does however set the time correctly

I am sure that I am doing something wrong here for for the life of me I
can not see it. Can anyone shed some light on this for me? I am about
to run out of hair.

Ron W
 
P

Paul G. Tobey [eMVP]

I'm not that adventurous right now, sorry. The debugger is the best way to
figure out what's going on. If you have the source code for OpenNETCF,
you'll find in ten minutes more about what could be causing it. I *have*
tested the time zone code myself (I wrote it), on my devices and it works
fine. Pinpointing exactly why there's a problem in the code that you're
actually running with is going to be a requirement, I think, to make any
progress.

Paul T.

Ron Weiner said:
Thanks for your help Paul.

I am pretty sure that I am not making the call twice as the project I am
testing this in contains one form with one button and one text box. The
OnClick event of the button has one line of code in it that calls the
SetSystemDateTime sub and that's the whole app.

If you are feeling ultra adventurous (or just wanted to take pity on me)
you could put the whole thing together in 5 minutes. In the meantime as I
am out of ideas for this solution and will look into attempting to wrap
the PInvokes and TZI structures up myself. I have little to loose, and
it's yet another chance to learn something. Might also get the folks at
Symbol involved. They have been helpful in the past.

Thanks again for your help.

Ron W

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:%[email protected]...
The standard date and daylight date items are not dates; they're
indications of when the transition between standard time and daylight
time occurs. So, for that time zone, daylight date would be 2am on the
second Sunday of March or something of that nature. So, you really can't
use ToDateTime on it and have the result make sense. It's a guess, but
I'd say that there's probably a bug in that conversion operation.

As for the display name, I really don't know. I suspect that, if you
stepped through the building of the collection and verified that you were
getting the right string back from the registry, having it put into the
collection item correctly, etc., you'd probably spot a problem there, but
reading the code, I don't see what it would be.

As for the error that you're reporting, I don't see any way that this can
be caused by the library. What gets passed to SetTimeZoneInformation()
(the API call), it just copied into some internal space where the shell
and everyone else gets it. It doesn't access the time zone list and add
or subtract one from some index or anything. The TIME_ZONE_INFORMATION
structure you pass doesn't even have to exist; you can completely make up
your own time zone. The only thing I can think of is that, somehow,
you're performing the SetTimeZoneInformation twice, once for the zone you
want, and once for the one you're ending up with...

Paul T.

RDub said:
Paul, thanks for your response. I knew should have just pasted the
entire Sub. I have been playing with this for some time and have tried
many variations on the same theme, all of which have come back with the
same results. Here is what I am working with now.

Private Sub SetSystemDateTime(ByVal strTimeZoneDisplayName As String,
_
ByVal dteUTCDateTime As DateTime)
' Purpose Set the time zone and the UTC time and date using the
pram's passed
Dim TZI As OpenNETCF.Win32.TimeZoneInformation = New
OpenNETCF.Win32.TimeZoneInformation
Dim TZS As OpenNETCF.Win32.TimeZoneState
Dim tziInfo As New OpenNETCF.Win32.TimeZoneCollection

tziInfo.Initialize()
' Iterate each time zone looking for the one that we want to use
For Each tziItem As OpenNETCF.Win32.TimeZoneInformation In
tziInfo
txtTZIDescr.Text += tziItem.DisplayName & vbCrLf
If tziItem.DisplayName = strTimeZoneDisplayName Then
'TZI = tziItem
TZI.Bias = tziItem.Bias
TZI.DaylightBias = tziItem.DaylightBias
TZI.DaylightDate = tziItem.DaylightDate
TZI.DaylightName = tziItem.DaylightName
TZI.DisplayName = tziItem.DisplayName
TZI.StandardBias = tziItem.StandardBias
TZI.StandardDate = tziItem.StandardDate
TZI.StandardName = tziItem.StandardName

txtTZIDescr.Text += "TZI.Bias " & TZI.Bias & vbCrLf
txtTZIDescr.Text += "TZI.DaylightBias " &
TZI.DaylightBias & vbCrLf
txtTZIDescr.Text += "TZI.DaylightDate " &
TZI.DaylightDate.ToDateTime.ToString & vbCrLf
txtTZIDescr.Text += "TZI.DaylightName " &
TZI.DaylightName & vbCrLf
txtTZIDescr.Text += "TZI.DisplayName " & TZI.DisplayName
& vbCrLf
txtTZIDescr.Text += "TZI.StandardBias " &
TZI.StandardBias & vbCrLf
txtTZIDescr.Text += "TZI.StandardDate " &
TZI.StandardDate.ToDateTime.ToString & vbCrLf
txtTZIDescr.Text += "TZI.StandardName " &
TZI.StandardName & vbCrLf

' Set the TimeZone First
OpenNETCF.Win32.DateTimeEx.SetTimeZoneInformation(TZI)
TZS =
OpenNETCF.Win32.DateTimeEx.GetTimeZoneInformation(TZI)
txtTZIDescr.Text += "Set Time Zone " & TZI.DisplayName &
vbCrLf
txtTZIDescr.Text += "Get TZI " & TZI.DisplayName & vbCrLf
txtTZIDescr.Text += "Get TZS " & TZS.ToString

' Then Set the GMT Time
OpenNETCF.Win32.DateTimeEx.SetSystemTime(dteUTCDateTime)
Exit For
End If
Next
End Sub

I am calling the sub with the following :

SetSystemDateTime("GMT-5 Eastern US", "06/05/2007 11:11:11 Am")

Revelant values that Printed in txtTZIDescr Text Box are:
...
GMT-6 Cent. America
GMT-5 Eastern US
TZI.Bias 300
TZI.DaylightBias -60
TZI.DaylightDate 1/1/0001 12:00:00 AM
TZI.DaylightName Eastern Daylight Ti
TZI.DisplayName GMT-5 Eastern US
TZI.StandardBias 0
TZI.StandardDate 1/1/0001 12:00:00 AM
TZI.StandardName Eastern Standard Ti
Set Time Zone GMT-5 Eastern US
Get TZI GMT-5 Eastern US
Get TZS Standard

The Dates look kinda fuggly, and the Daylight and standard names appear
to be truncated. Sure would appreciate any help you can provide.

Ron W


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message Question #1: how are you initializing tziInfo? Seems like you should
be calling Initialize()...

Question #2: when the SetTimeZoneInformation line is about to be
executed, what are the values in the tziItem?

Paul T.

I am having a heck of a time setting the Time Zone in my app. I am
using VS 2003 with OpenNETCF 1.4 and CF 1.0 on a Symbol MC50 running
PPC 2003.

Here is a snip of the code I am using:

Dim tziInfo As New OpenNETCF.Win32.TimeZoneCollection

For Each tziItem As OpenNETCF.Win32.TimeZoneInformation In
tziInfo
If tziItem.DisplayName = strTimeZoneDisplayName Then
' Set the TimeZone First

OpenNETCF.Win32.DateTimeEx.SetTimeZoneInformation(tziItem)

' Then Set the Universal Time

OpenNETCF.Win32.DateTimeEx.SetSystemTime(dteUTCDateTime)
Exit For
End If
Next

The code executes without error, however it is not setting the time
zone to the one I expected. For instance If strTimeZoneDisplayName
contains "GMT-5 Eastern US" When I inspect the device after this code
is run I see the Time zone is set to "GMT-5 Indiana (USA)". If I
select "GMT-6 Central US" I get "GMT-6 Saskatchewan", and so on. It
does however set the time correctly

I am sure that I am doing something wrong here for for the life of me
I can not see it. Can anyone shed some light on this for me? I am
about to run out of hair.

Ron W
 
G

Guest

Even I am having the same Problem. I am not seeing the expected Time Zone
set on the device. I am getting the TimeZoneInformation from the server (To
which the Pocket PC is sync'ing to) uisng the webservice and I am assigning
the values from that tzi to the newly created one before setting the TZI,
aslo after setting the TZI, when I get TZI, it is giving the right values,
but when I check the clock on the device, I am seeing the value that I set.

localhost1.TimeZoneInformation tzInfo = ps.GetCureentTimeZoneInfo(); //ps is
webserver
TimeZoneInformation tzi = new TimeZoneInformation();//struct
tzi.bias = tzInfo.bias;
tzi.daylightBias = tzInfo.daylightBias;
tzi.daylightName = tzInfo.daylightName;
tzi.standardBias = tzInfo.standardBias;
tzi.standardName = tzInfo.standardName;

ClassTime.SetTimeZoneInfo(tzi);//ClassTime - class

Thanks!!
-Malathi
 
P

Paul G. Tobey [eMVP]

The Control Panel applet is where you're going to check what the settings
are? If this is on generic Windows CE, that surprises me, but it doesn't
surprise me at all on Pocket PC. I would think that the control panel
applets for those two platforms are probably subconsciously assuming that
any zone that's set would be in its known list. Setting a zone with data
sent from a server, where the name might be a little different or some other
piece of information might be of a slightly different format could easily
cause a problem for the applet. Microsoft really needs to provide a
complete set of APIs in Win32 for enumerating, selecting, and reading time
zone information; for now, you have to test and test and test and adapt to
what you find.

Paul T.
 
G

Guest

Paul,

Thanks for your help.

-Jay

Jay said:
Even I am having the same Problem. I am not seeing the expected Time Zone
set on the device. I am getting the TimeZoneInformation from the server (To
which the Pocket PC is sync'ing to) uisng the webservice and I am assigning
the values from that tzi to the newly created one before setting the TZI,
aslo after setting the TZI, when I get TZI, it is giving the right values,
but when I check the clock on the device, I am seeing the value that I set.

localhost1.TimeZoneInformation tzInfo = ps.GetCureentTimeZoneInfo(); //ps is
webserver
TimeZoneInformation tzi = new TimeZoneInformation();//struct
tzi.bias = tzInfo.bias;
tzi.daylightBias = tzInfo.daylightBias;
tzi.daylightName = tzInfo.daylightName;
tzi.standardBias = tzInfo.standardBias;
tzi.standardName = tzInfo.standardName;

ClassTime.SetTimeZoneInfo(tzi);//ClassTime - class

Thanks!!
-Malathi
 
Joined
Jul 6, 2007
Messages
1
Reaction score
0
Seeing the same behavior

I am seeing the same behavior. I verified that I am passing in the right TimeZoneInformation. Also, I verified that it occurs if I call your wrapped method or the native call.
 

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