Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Brainstorm
  4. time and time zones
Forum Updated to NodeBB v4.3 + New Features

time and time zones

Scheduled Pinned Locked Moved Solved Brainstorm
18 Posts 6 Posters 3.6k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mzimmersM mzimmers

    @Christian-Ehrlicher the TZ string is more than just an offset; it's a series of tokens, most of which are intended to instruct the time-keeping facility as to what to do for DST. I'd greatly prefer not to have to build this string myself.

    This page has a short table containing what I want; if I could find a table that includes more names (the call to availableTimeZoneIds() returns 475 items), I'd just use it to create a table in my Qt app. I'm just hoping that someone knows of a way to obviate the need for doing this.

    JonBJ Online
    JonBJ Online
    JonB
    wrote on last edited by
    #4

    @mzimmers
    You haven't been around for a while!

    I don't see Qt code for that "extended TZ syntax". Posix or something? You might better find conversion code elsewhere on the web?

    mzimmersM 1 Reply Last reply
    1
    • JonBJ JonB

      @mzimmers
      You haven't been around for a while!

      I don't see Qt code for that "extended TZ syntax". Posix or something? You might better find conversion code elsewhere on the web?

      mzimmersM Offline
      mzimmersM Offline
      mzimmers
      wrote on last edited by
      #5

      @JonB yeah, I think this is outside the realm of Qt-dom. As for finding a pre-made table, I've been looking without success. For now, I'll create my own (borrowing from the link I posted above), but if anyone knows of a more complete listing, I'd love to hear about it.

      Thanks...

      1 Reply Last reply
      0
      • hskoglundH Offline
        hskoglundH Offline
        hskoglund
        wrote on last edited by
        #6

        Maybe you'll have to bite the bullet and go for the mother lode https://www.iana.org/time-zones

        mzimmersM 1 Reply Last reply
        0
        • hskoglundH hskoglund

          Maybe you'll have to bite the bullet and go for the mother lode https://www.iana.org/time-zones

          mzimmersM Offline
          mzimmersM Offline
          mzimmers
          wrote on last edited by
          #7

          @hskoglund unfortunately, even that doesn't have what I'm looking for; at least I didn't see it. Lots of other stuff, but not this.

          hskoglundH 1 Reply Last reply
          0
          • mzimmersM mzimmers

            @hskoglund unfortunately, even that doesn't have what I'm looking for; at least I didn't see it. Lots of other stuff, but not this.

            hskoglundH Offline
            hskoglundH Offline
            hskoglund
            wrote on last edited by
            #8

            @mzimmers Lots of stuff it is, but for example, if I look at my Ubuntu 19.10 machine, and go to /usr/share/zoneinfo (which is Ubuntu's copy of that mother lode), if i type for example the CET file, I get lots of junk but in the end I get

            I?I??J?K??L̿?M??N???OnnP???QW??Rle?S7l?TLG?UN?V,)?V?0?XFX??Y?(Z???[?
            \?]??^?_??`_?a}?b??c]̐d?e=????g??g藐h?r?i?y?j?T?k?[?l?qm?=?n?Soh?p?5qQ<rfs1tE?uv/?v??x??x??y?ِz??{λ?|?}???~y????  CETCEST
            CET-1CEST,M3.5.0,M10.5.0/3
            

            so it's there. But the zdump program refuses to dump it, I tried all the command switches :-(

            mzimmersM 1 Reply Last reply
            0
            • hskoglundH hskoglund

              @mzimmers Lots of stuff it is, but for example, if I look at my Ubuntu 19.10 machine, and go to /usr/share/zoneinfo (which is Ubuntu's copy of that mother lode), if i type for example the CET file, I get lots of junk but in the end I get

              I?I??J?K??L̿?M??N???OnnP???QW??Rle?S7l?TLG?UN?V,)?V?0?XFX??Y?(Z???[?
              \?]??^?_??`_?a}?b??c]̐d?e=????g??g藐h?r?i?y?j?T?k?[?l?qm?=?n?Soh?p?5qQ<rfs1tE?uv/?v??x??x??y?ِz??{λ?|?}???~y????  CETCEST
              CET-1CEST,M3.5.0,M10.5.0/3
              

              so it's there. But the zdump program refuses to dump it, I tried all the command switches :-(

              mzimmersM Offline
              mzimmersM Offline
              mzimmers
              wrote on last edited by
              #9

              @hskoglund so, if I understand this, I'd have to build the IANA software, generate all the files, and extract the TZ string I want from each one. That's just too labor-intensive to be a viable approach.

              I'm still amazed that someone out there doesn't maintain a table stored in a grid on a web page somewhere that I could just grab, but oh well...

              hskoglundH JonBJ 2 Replies Last reply
              0
              • mzimmersM mzimmers

                @hskoglund so, if I understand this, I'd have to build the IANA software, generate all the files, and extract the TZ string I want from each one. That's just too labor-intensive to be a viable approach.

                I'm still amazed that someone out there doesn't maintain a table stored in a grid on a web page somewhere that I could just grab, but oh well...

                hskoglundH Offline
                hskoglundH Offline
                hskoglund
                wrote on last edited by
                #10

                @mzimmers said in time and time zones:

                I'm still amazed that someone out there doesn't maintain a table stored in a grid on a web page somewhere that I could just grab, but oh well...

                Well never say never, if you build those files, you could be the one maintaining that table :=)

                1 Reply Last reply
                2
                • mzimmersM mzimmers

                  @hskoglund so, if I understand this, I'd have to build the IANA software, generate all the files, and extract the TZ string I want from each one. That's just too labor-intensive to be a viable approach.

                  I'm still amazed that someone out there doesn't maintain a table stored in a grid on a web page somewhere that I could just grab, but oh well...

                  JonBJ Online
                  JonBJ Online
                  JonB
                  wrote on last edited by
                  #11

                  @mzimmers
                  Can you give some "official", "definitive" link to the TZ formats you are talking about? Is there an RFC or an official body or something? So far I think I only saw a link to some example from 2012. Maybe there is a "body" which has a web service to return the tz format you require from a country name?

                  mzimmersM 1 Reply Last reply
                  0
                  • JonBJ JonB

                    @mzimmers
                    Can you give some "official", "definitive" link to the TZ formats you are talking about? Is there an RFC or an official body or something? So far I think I only saw a link to some example from 2012. Maybe there is a "body" which has a web service to return the tz format you require from a country name?

                    mzimmersM Offline
                    mzimmersM Offline
                    mzimmers
                    wrote on last edited by
                    #12

                    @JonB I wish I could. If I knew of such a body, it might have helped me in my search for the table I was looking for. I only know of it the POSIX time zone format as it's referenced by IANA and a few other sites like this.

                    JonBJ 1 Reply Last reply
                    0
                    • mzimmersM mzimmers

                      @JonB I wish I could. If I knew of such a body, it might have helped me in my search for the table I was looking for. I only know of it the POSIX time zone format as it's referenced by IANA and a few other sites like this.

                      JonBJ Online
                      JonBJ Online
                      JonB
                      wrote on last edited by JonB
                      #13

                      @mzimmers
                      OK, so this is all to do with zoneinfo. Are you Linux?

                      jon@ubuntu-19:~$ file /usr/share/zoneinfo/America/Los_Angeles 
                      /usr/share/zoneinfo/America/Los_Angeles: timezone data, version 2, 5 gmt time flags, 5 std time flags, no leap seconds, 186 transition times, 5 abbreviation chars
                      

                      Start reading from man tzfile (if you're not Linux man pages are available online).

                      I don't know where you ended up getting your table from, and the strings in the "tz extended format" for each "friendly" country name, but there may be a call or enough information there if you want to get/make these strings. If the host for your Qt app is Linux, you could leverage that from code.

                      Meanwhile, you might be interested in my own solution for the world's horrendous timezone rules? Abolish all timezones, and daylight savings, world-wide. Everywhere works on identical current time. (All set to one standard, which will obviously be UK/London/GMT/UTC.) If it's 08:14am in England, then it's same in Australia. So now there is no time conversions anywhere. The only difference is if I go to work from 8am to 5pm in England, Aussies go to work from 8pm to 5am, or similar. We all agree what a conference at 9am means, because it's 9am everywhere. Computer programs no longer have to worry about where you are. Simplez! I don't know why they don't put me in charge of international issues like this....

                      kshegunovK 1 Reply Last reply
                      0
                      • JonBJ JonB

                        @mzimmers
                        OK, so this is all to do with zoneinfo. Are you Linux?

                        jon@ubuntu-19:~$ file /usr/share/zoneinfo/America/Los_Angeles 
                        /usr/share/zoneinfo/America/Los_Angeles: timezone data, version 2, 5 gmt time flags, 5 std time flags, no leap seconds, 186 transition times, 5 abbreviation chars
                        

                        Start reading from man tzfile (if you're not Linux man pages are available online).

                        I don't know where you ended up getting your table from, and the strings in the "tz extended format" for each "friendly" country name, but there may be a call or enough information there if you want to get/make these strings. If the host for your Qt app is Linux, you could leverage that from code.

                        Meanwhile, you might be interested in my own solution for the world's horrendous timezone rules? Abolish all timezones, and daylight savings, world-wide. Everywhere works on identical current time. (All set to one standard, which will obviously be UK/London/GMT/UTC.) If it's 08:14am in England, then it's same in Australia. So now there is no time conversions anywhere. The only difference is if I go to work from 8am to 5pm in England, Aussies go to work from 8pm to 5am, or similar. We all agree what a conference at 9am means, because it's 9am everywhere. Computer programs no longer have to worry about where you are. Simplez! I don't know why they don't put me in charge of international issues like this....

                        kshegunovK Offline
                        kshegunovK Offline
                        kshegunov
                        Moderators
                        wrote on last edited by
                        #14

                        @JonB said in time and time zones:

                        I don't know where you ended up getting your table from, and the strings in the "tz extended format" for each "friendly" country name, but there may be a call or enough information there if you want to get/make these strings. If the host for your Qt app is Linux, you could leverage that from code

                        @mzimmers, I'd rather advise this instead of calling things on the command line:
                        http://man7.org/linux/man-pages/man3/strptime.3.html
                        http://man7.org/linux/man-pages/man3/strftime.3.html

                        unfortunately it does seem you need to build the TZ strings by hand. At least that's my understanding ...

                        Read and abide by the Qt Code of Conduct

                        JonBJ 1 Reply Last reply
                        0
                        • kshegunovK kshegunov

                          @JonB said in time and time zones:

                          I don't know where you ended up getting your table from, and the strings in the "tz extended format" for each "friendly" country name, but there may be a call or enough information there if you want to get/make these strings. If the host for your Qt app is Linux, you could leverage that from code

                          @mzimmers, I'd rather advise this instead of calling things on the command line:
                          http://man7.org/linux/man-pages/man3/strptime.3.html
                          http://man7.org/linux/man-pages/man3/strftime.3.html

                          unfortunately it does seem you need to build the TZ strings by hand. At least that's my understanding ...

                          JonBJ Online
                          JonBJ Online
                          JonB
                          wrote on last edited by JonB
                          #15

                          @kshegunov
                          I never intended he should do anything as a command (unless there is a convenient one which returns all the strings, which I have not seen). Only use the information from code. I thought the information in man tzfile where it documents the structure/content of the file would be enough to generate the "extended TZ format" string from?

                          strftime/strptime() are for dealing with datetime instances. I don't see how they would help generating the formatting strings he wants.

                          kshegunovK 1 Reply Last reply
                          0
                          • JonBJ JonB

                            @kshegunov
                            I never intended he should do anything as a command (unless there is a convenient one which returns all the strings, which I have not seen). Only use the information from code. I thought the information in man tzfile where it documents the structure/content of the file would be enough to generate the "extended TZ format" string from?

                            strftime/strptime() are for dealing with datetime instances. I don't see how they would help generating the formatting strings he wants.

                            kshegunovK Offline
                            kshegunovK Offline
                            kshegunov
                            Moderators
                            wrote on last edited by kshegunov
                            #16

                            May be, but I'm not convinced. This file may very well be in a privileged location, and it may change at any time under your feet (while you read), and ... well it's a file, you get it ... not ideal, by far.

                            @JonB said in time and time zones:

                            I don't see how they would help generating the formatting strings he wants.

                            You could extract the pertinent identifiers from the dt instances is the point (e.g. offsets and such). But again ... not ideal, by far.

                            Read and abide by the Qt Code of Conduct

                            1 Reply Last reply
                            0
                            • mzimmersM Offline
                              mzimmersM Offline
                              mzimmers
                              wrote on last edited by
                              #17

                              Not ideal, to say the least. I'm going to stand down on this exercise for now. Thanks to all who looked.

                              1 Reply Last reply
                              0
                              • Kent-DorfmanK Offline
                                Kent-DorfmanK Offline
                                Kent-Dorfman
                                wrote on last edited by Kent-Dorfman
                                #18

                                what you are asking for is POSIX TZ format. It can be pulled or generated from the POSIX tzfile(5) database. A quick search of the database on my machine shows that all of the timesonze files I searched contained a newline terminated TZ string fallback for dates after the prior exception rules. You most likely would have to parse the tzfiles according to the zone selected and use the fallback string if it exists, or build the correct string from the data if it doesn't exist. This of course assumes that you are on a unix/linux machine.

                                1 Reply Last reply
                                1

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved