Solved time and time zones
-
@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.
-
@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 :-(
-
@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...
-
@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 :=)
-
@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? -
-
@mzimmers
OK, so this is all to do withzoneinfo
. 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....
-
@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.htmlunfortunately it does seem you need to build the TZ strings by hand. At least that's my understanding ...
-
@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 inman 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. -
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.
-
Not ideal, to say the least. I'm going to stand down on this exercise for now. Thanks to all who looked.
-
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.