Thanks for this perspective. To clarify, we already have some (albeit somewhat hidden) functionality related to handling time zone /locales/ and local system time. This particular proposal (PEP 615) is only to provide an interface with the time zone database (i.e. it is for mapping the keys America/New_York to a representation of the data), it is not for supporting querying the system time zone locales. I have heard a potential proposal for doing things like "find out what ZoneInfo, if any, applies to my current locale and get a time zone object for it", but I consider this mostly out of scope because it's a small enough enhancement that we can do it without a PEP (which is something like an RFC), and it's also something that third party libraries can handle easily once they have ZoneInfo as a building block. Still, I'm probably going to be the one who looks into that (either for datetime or for a third party library), so it's very useful to have this handy collection of locale time zone information. Thanks! Paul On 2/25/20 11:39 PM, Brian Inglis wrote:
On 2020-02-25 19:40, Paul Ganssle wrote:
Thanks for the comments, I'll update the proposal in response. In any case, thanks so much for the comments, you've given me a lot of food for thought already! You may also want to bear in mind and take account of the existing system conventions around default user and system time zones, locales, and formats (I get annoyed if your tool ignores my configured preferences, or I have to set yet another preference, which probably lacks features, sucks, or doesn't do what I want e.g. MS Windows settings do not support time zone formats like %z %Z):
$ echo $TZ # env var TZ contains the user default time zone name America/Edmonton $ head /etc/timezone # /etc/timezone contains the system default timezone name America/Edmonton $ llgo /etc/localtime # /etc/localtime links to the system default timezone file lrwxrwxrwx 1 36 Feb 25 16:23 /etc/localtime -> /usr/share/zoneinfo/America/Edmonton $ l /usr/share/i18n/locales/en* # template locale definitions /usr/share/i18n/locales/en_AG /usr/share/i18n/locales/en_IN /usr/share/i18n/locales/en_AU /usr/share/i18n/locales/en_NG /usr/share/i18n/locales/en_BW /usr/share/i18n/locales/en_NZ /usr/share/i18n/locales/en_CA /usr/share/i18n/locales/en_PH /usr/share/i18n/locales/en_DK /usr/share/i18n/locales/en_SC /usr/share/i18n/locales/en_GB /usr/share/i18n/locales/en_SG /usr/share/i18n/locales/en_HK /usr/share/i18n/locales/en_US /usr/share/i18n/locales/en_IE /usr/share/i18n/locales/en_ZA '/usr/share/i18n/locales/en_IE@euro' /usr/share/i18n/locales/en_ZM /usr/share/i18n/locales/en_IL /usr/share/i18n/locales/en_ZW $ apropos locale-gen # generates configured definitions from templates locale-gen (8) - generates localisation files from templates locale.gen (5) - Configuration file for locale-gen $ llgo /etc/locale.* -rw-r--r-- 1 3.0K May 1 2019 /etc/locale.alias -rw-r--r-- 1 9.2K Feb 10 12:05 /etc/locale.gen $ localedef --list-archive # shows the system locales supported in # LOCPATH default $LOCALEDIR/locale-archive # LOCALEDIR default /usr/lib/locale/ en_CA en_CA.iso88591 en_CA.utf8 en_GB en_GB.iso88591 en_GB.utf8 en_US en_US.iso88591 en_US.utf8 $ locale # shows the current user locale settings LANG=en_CA.UTF-8 LANGUAGE=en_CA:en_GB:en_UK:en LC_CTYPE="en_CA.UTF-8" LC_NUMERIC="en_CA.UTF-8" LC_TIME="en_CA.UTF-8" LC_COLLATE="en_CA.UTF-8" LC_MONETARY="en_CA.UTF-8" LC_MESSAGES="en_CA.UTF-8" LC_PAPER="en_CA.UTF-8" LC_NAME="en_CA.UTF-8" LC_ADDRESS="en_CA.UTF-8" LC_TELEPHONE="en_CA.UTF-8" LC_MEASUREMENT="en_CA.UTF-8" LC_IDENTIFICATION="en_CA.UTF-8" LC_ALL= $ locale -ck LC_TIME # shows the current user locale time category settings LC_TIME abday="Sun;Mon;Tue;Wed;Thu;Fri;Sat" day="Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday" abmon="Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec" mon="January;February;March;April;May;June;July;August;September;October;November;December" am_pm="am;pm" d_t_fmt="%Y %b %d %a %T%z" d_fmt="%F" t_fmt="%T" t_fmt_ampm="%I:%M:%S %p %Z" era= era_year="" era_d_fmt="" alt_digits= era_d_t_fmt="" era_t_fmt="" time-era-num-entries=0 time-era-entries="S" week-ndays=7 week-1stday=19971130 week-1stweek=1 first_weekday=2 first_workday=2 cal_direction=1 timezone="" date_fmt="%Y %b %e %a %T %Z" time-codeset="UTF-8" alt_mon="January;February;March;April;May;June;July;August;September;October;November;December" ab_alt_mon="Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec"