Mikrotik use of TZ (timezone) database

Only another spreadsheet with very little use, but (IMHO) among the things that are "good to know".

For a small (side-side) project I am working on, I need to simulate in a drop down list (in an Excel worksheet) the same options available in ROS about countries (and while I am at it timezones too).

I wasn't able to find a suitable way to extract from a running ROS (in CHR) these two lists, so I went through the ROS files and attempted extracting strings.

And found an online resource reportedly listing the countries:
https://www.driverscat.eu/faq/mikrotik-wifi-qcom-countries.html

The Mikrotik manual reports:

verbatim:

Clock

RouterOS uses data from the TZ database. Most of the time zones from this database are included, and have the same names. Because local time on the router is used mostly for timestamping and time-dependent configuration, and not for historical date calculations, time zone information about past years is not included. Currently, only information starting from 2005 is included.

and nothing about the countries, but it would be logical that they use as well the TZ database for countries (used in ROS in /interface wifi country=).

Since I don't trust anyone, particularly on the internet, I actually checked both against the actual timezone database here:
https://www.iana.org/time-zones

And found some minor differences (mostly typos) between the extracted strings and the list published on driverscat.eu.

BUT I found several differences between the actual TZ database and the strings extracted, a lot of countries are simply missing in Mikrotik AND there are quite a few typos/differences, some are understandable, like Åland Islands becoming Aland Islands and a couple é's changed into e's, but Andorra becoming Andora and Macao becoming Macau?
:astonished_face:

Anyway, attached the comparison worksheet.
countries.zip (59.6 KB)

EDIT: updated with an added comparison against ISO 3166-1

Ok, I quickly made a spreadsheet for timezones too.
It is much less "refined" than the one for countries, because it seems a lost cause.

The good news are that there are seemingly not typos (the few ones are actually seemingly duplicated).

But it is a mess with tens of cities that are in the Mikrotik files but are nowhere to be found in the TZ database.

And the TZ database itself has "strange" entries for (say) Argentina, Indiana, Kentucky, North_Dakota. (I guess this is "normal" even if "strange")

And maybe we have found where "Macau" comes from (it is in the TZ database, but as we have seen above it is Macao in the country one) and Mikrotik has BOTH "Macao" and "Macau" in timezones.

Edit:
attached new version of the spreadsheet with the added backward sheet.

timezone.zip (119.6 KB)

Not sure what's the point of this post. MikroTik uses this one: https://www.iana.org/time-zones
And diacritics get lost because RouterOS does not support UTF-8
Minor differences comes from the fact that we update it rarely, every few months, or so.

The point is that for whatever reasons BESIDES the (understandable) simplification from UTF-8 into ASCII, AND some simplifications, like "Bolivia, Plurinational State of"->Bolivia,
there are TYPOS, some countries in the Mikrotik choices are written DIFFERENTLY from what is in the TZ database (and in a WRONG way).

And Mikrotik could provide (on the manual.mikrotik.com) the actual lists that are embedded in ROS, this way people would have an authoritative source and (evidently possible) typos would be easier to correct.

Here is a screenshot of only the differences (and BTW 56 entries are seemingly missing):

So, the correct statement should be something more like:
We made our own list of countries, inspired by the TZ database, choosing which countries to include and writing them as we fancy.

Why do you think there is a correlation between wifi-qcom countries and timzones?

I would assume the wifi country list is based on wireless-regdb.

Good :slightly_smiling_face:, can you tell me where in the wireless-regdb is the list of countries?
https://wireless.docs.kernel.org/en/latest/en/developers/regulatory/wireless-regdb.html

AFAICT entries in the database use the (unique) country ID, see the example:

ASCII file format

Below is an example of a country entry for the db.txt regulatory file for EC (Ecuador):

and the actual full names still come from the TZ database (or from another database?).

Yes, it seems to me regdb works with ISO 3166-1 alpha-2. So I don't know where these country names come from actually. As far as I know, RouterOS doesn't use wireless-regdb anyway.

Just compared TZ database country against ISO 3166-1.
They are very similar (though not exactly the same), but also ISO 3166-1 cannot be the Mikrotik source (without changes).
There is a long time debate whether Turkey should be called Turkey (as in TZ database) or Türkiye (as in the ISO 3166-1) but the Mikrotik using Turkey is fine.
BUT IF BOTH TZ database and ISO 3166-1 call Côte d'Ivoire "Côte d'Ivoire" Mikrotik country "Ivory Coast" appears arbitrary (though still correct).

In any case, these remain typos in Mikrotik:
Andora->Andorra
Central Africa Republic->Central African Republic
Macau->Macao

And the country:
Heard Island and McDonald Islands
is seemingly only present in Mikrotik's list, even if these islands actually exist, they are not much populated and it seems unfair that they have a Mikrotik setting while the good people of (say) Pitcairn miss it. :wink:

Even if they fixed the misspellings (more likely than typos): a lot of to consider for migration. People can have scripts, exports, backups, etc. Needs to be considered, or you end up with "no country set" or something.

Exactly. :slightly_smiling_face:
What I am (slowly) trying to put together is a helper or configuration maker for CAPsMAN/CAPs:
CAPsMAN - CAP VLAN configuration example on help.mikrotik.com
but without exact lists there is the risk (remote as most and more common countries and cities are correct anyway) that the output will be something that will be rejected by RouterOS, nothing that someone with a little experience cannot correct/fix when it happens, but since the whole idea of such a helper is its use by newbies, it should be as foolproof as possible.

The best solution would be if the good Mikrotik guys would publish on manual.mikrotik.com the actual list that they use both in CLI and in Winbox, this way one would have a sure method of validation.

OK, solved (or nearly solved) the mistery (or the non-mistery).

The strings for timezones in Mikrotik files belong to an old (possibly very old) version of the TZ database, that include (for backward compatibility) a number of entries that are considered obsolete and do not belong to the current TZ database, but that are still available as link/redirects in a different document:
https://data.iana.org/time-zones/tzdb/backward

I updated - even if it still is unfinished and will likely remain forever unfinished - the timezone spreadsheet in post #2 that now include a "backward" sheet.

We can now confidently state that Mikrotik's implementation of TZ database is partially backward.
:wink:
:rofl:

Fallo per i codici Belfiore...

(Italian problem)

... e non hai visto i codici comune di pubblica sicurezza alla luce della unificazione di comuni limitrofi ...
https://alloggiatiweb.poliziadistato.it/portalealloggiati/tabelle.aspx
(Another Italian problem)

No... Luckily I've never had to deal with it...