On 2025-09-13 22:24, Eli Zaretskii wrote: > Only the second one can be checked relatively easily by looking in the > directory where the zoneinfo files are installed. But how does one > validate the other 2 forms? And how does one know which format iz > used to begin with? Plus, not every TZDB installation has "zoneinfo files" in the usual sense; some have a database using some other format. However, something along those lines could be done, if somebody wanted to maintain it (I don't). The idea is not to exactly validate the forms; instead, do a reasonably conservative validation that rejects forms that (as as we know) are not supported on any Emacs platform. This would accept some unlikely mistakes, but would be good enough for most users. Something like the following, perhaps, and then have world-clock-display run (world-clock--check-entries alist) first thing. None of this is tested; it's just a sketch. And I'm not advocating for this change as it's hacky and I would rather not support it, but if somebody else wants to take it up it should work acceptably. (defconst world-clock--tz-regexp (let* ((abbr "\\([A-Za-z]\\{3,\\}\|<[A-Za-z0-9+-]\\{3,\\}>\\)") (offset "\\([+-]?[0-9]+\\(:[0-5][0-9]\\(:[0-5][0-9]\\)?\\)?\\)") (date "\\(J?[0-9]+\\|M\\([1-9]\\|1[0-2]\\)\\.[1-5]\\.[0-6]\\)") (time offset) (comma-date-time (concat "," date "\\(/" time "\\)?")) ;; TZDB time zones at UTC offset zero at the Epoch. ;; The others are filtered out by the call to current-time-zone. ;; This list is for circa 2025 TZDB and may need updating. (tzdb+0000-regexp "\\(Africa/\\(Abidjan\\|Accra\\|Bamako\\|Banjul\\|Bissau\\|Conakry" "" "\\|Dakar\\|Freetown\\|Lome\\|Monrovia\\|Nouakchott" "" "\\|Ouagadougou\\|Sao_Tome\\|Timbuktu\\)" "\\|America/Danmarkshavn" "\\|Atlantic/\\(Azores\\|Reykjavik\\|St_Helena\\)" "\\|\\(Etc/\\)?\\(GMT[+-]?0\\|Greenwich\\|UCT\\|UTC" "" "\\|Universal\\|Zulu\\)" "\\|Iceland") ;; POSIX.1-2017 (and earlier) TZ strings. (posix-tz-regexp (concat "\\(" abbr offset "\\(" abbr offset "?\\(" comma-date-time comma-date-time "\\)?\\)?\\)"))) (concat "\\`:?\\(" tzdb+0000-regexp "\\|" posix-tz-regexp "\\)\\'"))) (defun world-clock--check-entries (alist) (dolist (pair alist) (let ((tz (car pair))) (unless (string-match-p world-clock--tz-regexp tz) (when (zerop (car (current-time-zone 0 tz))) (error "Invalid time zone specification" tz)))))) PS. I noticed some other glitches in this area and installed the attached patch on master. It's a pain to maintain this stuff!