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 7907965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:42:17+00:00 2026-06-03T11:42:17+00:00

I have been trying to use TimeZoneInfo.GetSystemTimeZones in .net4 to replace our old method

  • 0

I have been trying to use TimeZoneInfo.GetSystemTimeZones in .net4 to replace our old method which uses COM to call into some MFC code. However, I’ve had to revert to the COM method because GetSystemTimeZones doesn’t return all time zones. Being based in the UK and not including GMT Standard Time in our list of options is a problem.

When I look in the registry, I find that GMT Standard Time has a Dynamic DST subkey with no rules defined. I downloaded the .net4 source code and, in TimeZoneInfo.cs, GetSystemTimeZones eventually calls TryCreateAdjustmentRules which appears to return false if the Dynamic DST key has no FirstEntry or LastEntry defined.

            //
            // loop over all of the "<time_zone_name>\Dynamic DST" hive entries 
            // 
            // read FirstEntry  {MinValue      - (year1, 12, 31)}
            // read MiddleEntry {(yearN, 1, 1) - (yearN, 12, 31)} 
            // read LastEntry   {(yearN, 1, 1) - MaxValue       }

            // read the FirstEntry and LastEntry key values (ex: "1980", "2038")
            Int32 first = (Int32)dynamicKey.GetValue(c_firstEntryValue, -1, RegistryValueOptions.None); 
            Int32 last = (Int32)dynamicKey.GetValue(c_lastEntryValue, -1, RegistryValueOptions.None);

            if (first == -1 || last == -1 || first > last) { 
                rules = null;
                return false; 
            }

As TryCreateAdjustmentRules returns false, TryGetTimeZoneByRegistryKey throws an InvalidTimeZoneException which means GMT Standard Time doesn’t get added into the time zone collection. I’ve tried deleting the empty Dynamic DST subkeys but something adds them back in again (probably Windows Update).

I’ve done alot of searching but haven’t seen anyone else report this problem. I’m not sure whether there is a GetSystemTimeZones fix or whether I can stop the empty Dynamic DST subkey appearing in the first place. Any ideas?

  • 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. Editorial Team
    Editorial Team
    2026-06-03T11:42:20+00:00Added an answer on June 3, 2026 at 11:42 am

    It turns out that the problem is with our COM object and not with the .NET code. The code to read the registry should only be reading but it mistakenly calls RegCreateKey to optimise multiple calls to the same registry branch.

    When the COM object is registered (with admin rights) because of a new version, it loads the time zones and creates Dynamic DST for the local time zone which in my case is GMT/UTC.

    Administrators, I guess this question should be marked for deletion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to use the hibernate dialect for SQLite from http://code.google.com/p/hibernate-sqlite/ in
I have been trying to use the gem 'character-encodings' which doesn't build in 1.9.2
I have been trying to use an update trigger which checks for the title_id
I have been trying to use querydsl in a project which is an osgi
I have been trying to use http://msdn.microsoft.com/en-us/library/akfttx8c(v=VS.90).aspx example for VB to see how virtual
We have been trying to use virtual machines for build servers. Our build servers
I have been trying to use the step() method on Date object to retrieve
I have been trying to use the comments.add REST api method to add comments
I have been trying to use routes.rb for creating a URL /similar-to-:product (where product
I have been trying to use/save the boolean value of a checkbox in other

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.