MorphOS and daylight saving time
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    Posts: 138 from 2015/3/31
    Hello

    I have a question regarding locale and time differences.
    In my program I have times given in GMT and I would like to convert them to the users time zone, I found the Locale.loc_GMTOffset but it shows for me (Germany) -60 min, which is in principle right Germany is GMT+1 but atm. we have daylight saving time, so it should be GMT+2. Is there a way to get this informations as well?

    Thanks in advance.
  • »17.09.16 - 15:48
    Profile Visit Website
  • MorphOS Developer
    geit
    Posts: 1034 from 2004/9/23
    There simply is no proper way for doing that without using some database which also needs frequent updates.

    Some countries change the switch days every year using a couple of dice to specify them.

    For a proper implementation such a database would be required. Also someone maintaining it.

    SetClockNTP just knows a bunch of countries which are switching time on fixed dates. e.g. last sunday in october.

    So it simply takes time zone information from locale and the matching GMT together with a build in list of rules for the day time switches. It has no proper and fully featured implementation as that would require the mentioned database containing up to date information, which would be a job for locale.library itself.
  • »18.09.16 - 00:05
    Profile
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    Posts: 138 from 2015/3/31
    hmm I thought so, just asked to be sure.

    So no tzdata use currently (thats the database already exists for such things), at C it should be easy to use, ok maybe not so important. I guess for my problem would be even easier to compare it to the current set time if one hour difference it's a daylight saving time ;-)

    Thanks for the answer.
  • »19.09.16 - 17:56
    Profile Visit Website