Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 104181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:14:28+00:00 2026-05-11T01:14:28+00:00

Our product contains a task-manager system that allows applications to run code in a

  • 0

Our product contains a task-manager system that allows applications to run code in a DLL upon a scheduled interval, specify rules about whether a failure of the task should disable the related application, etc. Mostly it’s used for data-upload, data-download, local database maintenance, etc. One of the functions used is to sync the devices time via NTP and set the OS’ timezone info. For this, we use OpenNetCF’s DateTimeHelper class, which seems to serve as a wrapper around Win32 P/Invokes.

One of the other features of the task manager is that if a task runs longer than its allotted time window, the task manager will Thread.Abort() it to allow other tasks to run. We’re seeing an alarming number of thread abortions in which the highest function on the stack is OpenNetCF.WindowsCE.NativeMethods.SetTimeZoneInformation(). Why would the underlying P/Invoke (SetTimeZoneInfo) hang for such a long time?

Our code runs on Windows CE 4.2, and with a much smaller userbase, on Windows CE 5.0 — the code here is the same between the two versions. So far, I’ve seen this occur on 4.2 devices but never on 5.0, and even with the smaller number of users on 5.0, I think I would have seen it had it been present there.

The function below is the function from which the problem stems. It converts a time zone abbreviation to its full name, then uses the name to find the right time zone and attempts to set the device’s current time zone to that one.

         public static bool SetTimeZone(string timeZoneAbbreviation)         {             string TimeZoneInfo = string.Empty;             bool timeZoneChanged = false;              switch (timeZoneAbbreviation)             {                 case ALASKA:                     TimeZoneInfo = ALASKA_TZN;                     break;                 case ALASKA_ALT:                     TimeZoneInfo = ALASKA_TZN;                     break;                 case ATLANTIC:                     TimeZoneInfo = ATLANTIC_TZN;                     break;                 case ATLANTIC_ALT:                     TimeZoneInfo = ATLANTIC_TZN;                     break;                 case CENTRAL:                     TimeZoneInfo = CENTRAL_TZN;                     break;                 case CENTRAL_ALT:                     TimeZoneInfo = CENTRAL_TZN;                     break;                 case EASTERN:                     TimeZoneInfo = EASTERN_TZN;                     break;                 case INDIANA:                     TimeZoneInfo = INDIANA_TZN;                     break;                 case HAWAII:                     TimeZoneInfo = HAWAII_TZN;                     break;                 case MOUNTAIN:                     TimeZoneInfo = MOUNTAIN_TZN;                     break;                 case ARIZONA:                     TimeZoneInfo = ARIZONA_TZN;                     break;                 case PACIFIC:                     TimeZoneInfo = PACIFIC_TZN;                     break;                 case PACIFIC_ALT:                     TimeZoneInfo = PACIFIC_TZN;                     break;                  default:                                         break;             }              TimeZoneInfo += '\0';              TimeZoneCollection tzc = new TimeZoneCollection();             tzc.Initialize();              foreach (TimeZoneInformation tzi in tzc)             {                 string tzDisplayName = tzi.DisplayName.TrimEnd(new char[]{'\\','0'});                  if (tzDisplayName.ToUpper(CultureInfo.CurrentCulture).Equals(TimeZoneInfo.ToUpper(CultureInfo.CurrentCulture)))                 {                     DateTimeHelper.SetTimeZoneInformation(tzi);                     System.Globalization.CultureInfo.CurrentCulture.ClearCachedData();                     timeZoneChanged = true;                     break;                 }             }              return timeZoneChanged;         } 

Thanks as always for your help. Any thoughts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:14:28+00:00Added an answer on May 11, 2026 at 1:14 am

    The DateTimeHelper.SetTimeZoneInformation call is a very thin wrapper around a P/Invoke to the SetTimezoneInformation API (I just verified that in the source). It basically makes the call and checks the return code – nothing more, so that pretty much rules out the SDF itself as the root cause.

    Next, looking at the MSDN doc for SetTimezoneInformation, it’s a really straightforward synchronous call that returns TRUE or FALSE. This tells me that the API is likely not the root cause either.

    One thing to remeber in CE is that you can never assume the platform is flawless becasue it’s done by the OEM and therefore can have variations. The fact that you see the failure in 4.2 and not 5.0 would lead me to check the following:

    1. Make sure the 4.2 device image has all QFEs applied
    2. See if there is a OS code difference between 4.2 and 5.0 for the timezone stuff (I doubt it, but I don’t have PB 4.2 installed any longer).
    3. Check the OEM implementation for setting time. Changing the zone implicitly makes a call to set the time and it’s possible there’s a bug in the 4.2 BSP that has a potential lock or race that you’re hitting.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 57k
  • Answers 57k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Thank you both very much for your answers. I chose… May 11, 2026 at 8:30 am
  • added an answer Define Obj1 and Obj2 in your .cpp instead of at… May 11, 2026 at 8:30 am
  • added an answer There's no pitfall. It will sleep for as long as… May 11, 2026 at 8:30 am

Top Members

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.

      Related Questions

      No related questions found