WindowsCE.TimeZoneInformation / TimeZoneCollection

Last post 05-11-2011 2:01 by mayank.parmar@clariontechnologies.co.in. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 11-24-2006 12:10

    WindowsCE.TimeZoneInformation / TimeZoneCollection

    I'm using PPC 2003 (1st Edition) on a Symbol 9060 device.

    Caveat: I'm using the prebuilt SDF binaries and looking at the source for SDF 2.0 so I don't know if there is a mismatch between them.

    Issue #1:

    TimeZoneCollection.Initialize(int) which takes a GMT offset in minutes. Documentation states: "for all timezones at GMT-5:00, pass -300 (minutes)" Therefore I would expect the collection to be populated with GMT-5:00 with a parameter of -300, however, it is returning the GMT+5:00 zones in the collection. Flipping the sign gives the opposite result (what I want but not what I expect). It is going through the citydb.dll method, and I'm not sure if this is a system builder bug or OS bug, as the SDF code looks OK. Is anyone else experiencing this behavior?

    Issue #2:

    Initializing the array with the default (all time zones), and iterating through it, ala
    TimeZoneInformation tzi = (TimeZoneInformation)collect[i];
    when accessing tzi.DaylightName and tzi.StandardName at index 31 (happens to be "GMT+1 W Cent Africa" on my device) throws an ArgumentOutOfRangeException. I didn't look at this one too closely, but can see where it is happening.

    Steve
  • 07-04-2007 13:41 In reply to

    Re: WindowsCE.TimeZoneInformation / TimeZoneCollection

    I get the same results as Steven on the PPC2300 emulator. Furthermore I spent a lot of time investigating why I did not get any StandardDate and DaylightDate when setting the timezone to any of the TimeZoneInformations I get out of the TimeZoneCollection.

    As it turns out InitializeTimeZoneCollection does not set StandardDate and DaylightDate and they are not read in the struct OpenNETCF.Win32.TZData which is used to interpret the data returned from citydb.ClockGetTimeZoneDataByOffset(). However, the SystemTimes are there and here's how to get it out:

    public TZData(IntPtr pData)
    {
    Name = Marshal.PtrToStringUni((IntPtr)Marshal.ReadInt32(pData));
    pData = (IntPtr)(pData.ToInt32() + 4);
    ShortName = Marshal.PtrToStringUni((IntPtr)Marshal.ReadInt32(pData));
    pData = (IntPtr)(pData.ToInt32() + 4);
    DSTName = Marshal.PtrToStringUni((IntPtr)Marshal.ReadInt32(pData));
    pData = (IntPtr)(pData.ToInt32() + 4);
    GMTOffset = Marshal.ReadInt32(pData);
    pData = (IntPtr)(pData.ToInt32() + 8);
    DSTOffset = Marshal.ReadInt32(pData);
    pData = (IntPtr)(pData.ToInt32() + 4);
    byte[] buf = new byte[32];
    Marshal.Copy(pData, buf, 0, 32);
    StandardDate = new SystemTime(buf);
    DaylightDate = new SystemTime(buf, 16);
    }

    and then in TimeZoneCollection.Initialize the lines

    tzi.StandardDate = tmp.StandardDate;
    tzi.DaylightDate = tmp.DaylightDate;

    needs to be added in the Pocket PC section.

    I have been using source from SDF1.4, but the problem is the same with the SDF2.1 binaries.

    Martin K
  • 04-03-2008 16:35 In reply to

    Re: WindowsCE.TimeZoneInformation / TimeZoneCollection

    I wonder if this is part of a problem I see and posted on bugzilla?

     if I try to set "Eastern Time"  as in the normal GMT-5 Eastern Standard/Daylight

    the control pannel shows Indiana Time both are -300 minutes but have different standard / daylight rules.

  • 04-04-2008 14:46 In reply to

    Re: WindowsCE.TimeZoneInformation / TimeZoneCollection

    with the ppc 2003 emulator this does not work. have not tested it with "real hardware yet.

    on CE 4.1 the registry method does work.

  • 04-12-2008 10:56 In reply to

    Re: WindowsCE.TimeZoneInformation / TimeZoneCollection

    Ref Issue #2.

    I had the same problem - it's because the DaylightName (and StandardName??) from citydb are 33 characters long (although they appear to be mainly spaces). There is only room for 64 bytes in the time zone information structure.

     Clipping all names to 31 characters seems to work.

     

    On the subject of time zones - there appears to be a further problem. when selecting a zone with no DST from one actively using DST (I tested London (BST) to Casablanca) - the clock remains in daylight mode. This will probably be unnoticed unless you check the SystemTime (UTC) of the return from DateTimeHelper.GetTimeZoneInformation.

    A call to SetDaylightTime (not in the OpenNETCF??) is needed to sort it out. (Tested on WM6 emulator).

     

  • 05-11-2011 2:01 In reply to

    Re: WindowsCE.TimeZoneInformation / TimeZoneCollection

    Hi All,

    While using:

    OpenNETCF.WindowsCE.DateTimeHelper.SetTimeZoneInformation(tziChk)

    If I try to set "Eastern Standard Time" as in the normal GMT-5 Eastern Standard/Daylight, The control pannel shows "Indiana Time" both are -300 minutes but have different standard / daylight rules.

    Same way if I try to set "Central Standard Time" as in the normal GMT-5 Eastern Standard/Daylight, The control pannel shows "Canadian Central Standard Time".

    Regards,

    Mayank Parmar

    mayank.parmar@clariontechnologies.co.in

    M: +91 9727748789

    Mayank Parmar

    Software Engineer

    Ahmedabad, India

    M: +91 9727748789

Page 1 of 1 (6 items)