Update the utcIdList (now that I've worked out where it came from)

It was originally (without any comment to this effect, either in the
code or the commit message) just the list of offset-zones
corresponding to known Windows zones' offsets, augmented to include
each whole hour offset out to ±14 hours. Absent documentation, of
course, this was not maintained.

Added the four offset zones implied by that, that hadn't been added
when new entries joined the Windows IDs with novel offsets. Check,
after scanning CLDR for Windows data, that this has been kept up to
date. Updated the generated data.

Change-Id: I3cf3932c320876f7f2f74840d8c3951be49cfe70
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2024-03-11 20:24:56 +01:00
parent 5f63885e84
commit 08c877a703
3 changed files with 91 additions and 62 deletions

View File

@ -768,39 +768,43 @@ static constexpr UtcData utcDataTable[] = {
{ 7657,-43200 }, // UTC-12:00 { 7657,-43200 }, // UTC-12:00
{ 7667,-39600 }, // UTC-11:00 { 7667,-39600 }, // UTC-11:00
{ 7677,-36000 }, // UTC-10:00 { 7677,-36000 }, // UTC-10:00
{ 7687,-32400 }, // UTC-09:00 { 7687,-34200 }, // UTC-09:30
{ 7697,-28800 }, // UTC-08:00 { 7697,-32400 }, // UTC-09:00
{ 7707,-25200 }, // UTC-07:00 { 7707,-28800 }, // UTC-08:00
{ 7717,-21600 }, // UTC-06:00 { 7717,-25200 }, // UTC-07:00
{ 7727,-18000 }, // UTC-05:00 { 7727,-21600 }, // UTC-06:00
{ 7737,-16200 }, // UTC-04:30 { 7737,-18000 }, // UTC-05:00
{ 7747,-14400 }, // UTC-04:00 { 7747,-16200 }, // UTC-04:30
{ 7757,-12600 }, // UTC-03:30 { 7757,-14400 }, // UTC-04:00
{ 7767,-10800 }, // UTC-03:00 { 7767,-12600 }, // UTC-03:30
{ 7777, -7200 }, // UTC-02:00 { 7777,-10800 }, // UTC-03:00
{ 7787, -3600 }, // UTC-01:00 { 7787, -7200 }, // UTC-02:00
{ 7797, 0 }, // UTC { 7797, -3600 }, // UTC-01:00
{ 7821, 3600 }, // UTC+01:00 { 7807, 0 }, // UTC
{ 7831, 7200 }, // UTC+02:00 { 7831, 3600 }, // UTC+01:00
{ 7841, 10800 }, // UTC+03:00 { 7841, 7200 }, // UTC+02:00
{ 7851, 12600 }, // UTC+03:30 { 7851, 10800 }, // UTC+03:00
{ 7861, 14400 }, // UTC+04:00 { 7861, 12600 }, // UTC+03:30
{ 7871, 16200 }, // UTC+04:30 { 7871, 14400 }, // UTC+04:00
{ 7881, 18000 }, // UTC+05:00 { 7881, 16200 }, // UTC+04:30
{ 7891, 19800 }, // UTC+05:30 { 7891, 18000 }, // UTC+05:00
{ 7901, 20700 }, // UTC+05:45 { 7901, 19800 }, // UTC+05:30
{ 7911, 21600 }, // UTC+06:00 { 7911, 20700 }, // UTC+05:45
{ 7921, 23400 }, // UTC+06:30 { 7921, 21600 }, // UTC+06:00
{ 7931, 25200 }, // UTC+07:00 { 7931, 23400 }, // UTC+06:30
{ 7941, 28800 }, // UTC+08:00 { 7941, 25200 }, // UTC+07:00
{ 7951, 30600 }, // UTC+08:30 { 7951, 28800 }, // UTC+08:00
{ 7961, 32400 }, // UTC+09:00 { 7961, 30600 }, // UTC+08:30
{ 7971, 34200 }, // UTC+09:30 { 7971, 31500 }, // UTC+08:45
{ 7981, 36000 }, // UTC+10:00 { 7981, 32400 }, // UTC+09:00
{ 7991, 39600 }, // UTC+11:00 { 7991, 34200 }, // UTC+09:30
{ 8001, 43200 }, // UTC+12:00 { 8001, 36000 }, // UTC+10:00
{ 8011, 46800 }, // UTC+13:00 { 8011, 37800 }, // UTC+10:30
{ 8021, 50400 }, // UTC+14:00 { 8021, 39600 }, // UTC+11:00
{ 8031, 43200 }, // UTC+12:00
{ 8041, 45900 }, // UTC+12:45
{ 8051, 46800 }, // UTC+13:00
{ 8061, 50400 }, // UTC+14:00
}; };
static constexpr char windowsIdData[] = { static constexpr char windowsIdData[] = {
@ -1489,28 +1493,31 @@ static constexpr char ianaIdData[] = {
0x6f, 0x72, 0x73, 0x65, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x31, 0x34, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x6f, 0x72, 0x73, 0x65, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x31, 0x34, 0x3a, 0x30, 0x30, 0x0, 0x55,
0x54, 0x43, 0x2d, 0x31, 0x33, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x31, 0x32, 0x3a, 0x54, 0x43, 0x2d, 0x31, 0x33, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x31, 0x32, 0x3a,
0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x31, 0x31, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x31, 0x31, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43,
0x2d, 0x31, 0x30, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x39, 0x3a, 0x30, 0x30, 0x2d, 0x31, 0x30, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x39, 0x3a, 0x33, 0x30,
0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x38, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x39, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30,
0x37, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x36, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x38, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x0, 0x55,
0x54, 0x43, 0x2d, 0x30, 0x35, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x34, 0x3a, 0x54, 0x43, 0x2d, 0x30, 0x36, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x35, 0x3a,
0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x34, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x34, 0x3a, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43,
0x2d, 0x30, 0x33, 0x3a, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x33, 0x3a, 0x30, 0x30, 0x2d, 0x30, 0x34, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x33, 0x3a, 0x33, 0x30,
0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x32, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x33, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30,
0x31, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x20, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x30, 0x3a, 0x32, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x31, 0x3a, 0x30, 0x30, 0x0, 0x55,
0x30, 0x30, 0x20, 0x55, 0x54, 0x43, 0x2d, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x54, 0x43, 0x20, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x20, 0x55, 0x54, 0x43,
0x2b, 0x30, 0x31, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x32, 0x3a, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x31, 0x3a, 0x30, 0x30,
0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x33, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x32, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30,
0x33, 0x3a, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x34, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x33, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x33, 0x3a, 0x33, 0x30, 0x0, 0x55,
0x54, 0x43, 0x2b, 0x30, 0x34, 0x3a, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x35, 0x3a, 0x54, 0x43, 0x2b, 0x30, 0x34, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x34, 0x3a,
0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x35, 0x3a, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x35, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43,
0x2b, 0x30, 0x35, 0x3a, 0x34, 0x35, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x36, 0x3a, 0x30, 0x30, 0x2b, 0x30, 0x35, 0x3a, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x35, 0x3a, 0x34, 0x35,
0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x36, 0x3a, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x36, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30,
0x37, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x38, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x36, 0x3a, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x0, 0x55,
0x54, 0x43, 0x2b, 0x30, 0x38, 0x3a, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x39, 0x3a, 0x54, 0x43, 0x2b, 0x30, 0x38, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x38, 0x3a,
0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x39, 0x3a, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x38, 0x3a, 0x34, 0x35, 0x0, 0x55, 0x54, 0x43,
0x2b, 0x31, 0x30, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x31, 0x31, 0x3a, 0x30, 0x30, 0x2b, 0x30, 0x39, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x30, 0x39, 0x3a, 0x33, 0x30,
0x0, 0x55, 0x54, 0x43, 0x2b, 0x31, 0x32, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x31, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x31, 0x30, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x31,
0x33, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x31, 0x34, 0x3a, 0x30, 0x30, 0x0 0x30, 0x3a, 0x33, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x31, 0x31, 0x3a, 0x30, 0x30, 0x0, 0x55,
0x54, 0x43, 0x2b, 0x31, 0x32, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x31, 0x32, 0x3a,
0x34, 0x35, 0x0, 0x55, 0x54, 0x43, 0x2b, 0x31, 0x33, 0x3a, 0x30, 0x30, 0x0, 0x55, 0x54, 0x43,
0x2b, 0x31, 0x34, 0x3a, 0x30, 0x30, 0x0
}; };
static constexpr char aliasIdData[] = { static constexpr char aliasIdData[] = {

View File

@ -185,6 +185,18 @@ def main(out, err):
subsequent_indent=' ', width=80)) + '\n') subsequent_indent=' ', width=80)) + '\n')
return 1 return 1
# Offsets of the windows tables, that are whole numbers of minutes, in minutes:
winOff = set(m for m, s in (divmod(v, 60) for k, v in windowsIdList) if s == 0)
winUtc = set(f'UTC-{h:02}:{m:02}'
for h, m in (divmod(-o, 60) for o in winOff if o < 0)).union(
f'UTC+{h:02}:{m:02}'
for h, m in (divmod(o, 60) for o in winOff if o > 0))
# All such offsets should be represented by entries in utcIdList:
newUtc = winUtc.difference(n for n, o in utcIdList)
if newUtc:
err.write(f'Please add {", ".join(newUtc)} to zonedata.utcIdList\n')
return 1
out.write('Input files parsed, now writing data\n') out.write('Input files parsed, now writing data\n')
try: try:

View File

@ -17,17 +17,23 @@ here, research the relevant zone's offset and add a new entry to the
list of twoples, preserving the ordering. Internet search engines and list of twoples, preserving the ordering. Internet search engines and
timeanddate.com can help with researching the offset. Note that some timeanddate.com can help with researching the offset. Note that some
UTC offset zones (giving only the hour) are present in windowsIdList. UTC offset zones (giving only the hour) are present in windowsIdList.
When adding an entry to windowsIdList, check whether its offset
corresponds to that of some entry in utcIdList; if not, add such an
entry.
The utcIdList is again a list of tuples (name, offset), associating The utcIdList is again a list of tuples (name, offset), associating
various UTC-offset names with their offsets in seconds. Aside from various UTC-offset names with their offsets in seconds. Aside from
'UTC' itself, shared with windowsIdList, these include minutes in 'UTC' itself, shared with windowsIdList, these include minutes in
their offsets even when they are whole hour offsets. It is not clear their offsets even when they are whole hour offsets. The list contains
where this particular list of offsets came from, but entries should the UTC-equivalents of all offsets seen in the windowsIdList, plus the
not be removed as they make up the available zones of the UTC whole hours out to ±14 hours, the two verbose forms of UTC±00:00 and
back-end. (That recognizes other offset zones, and its is-available any legacy entries from past Windows zone offsets. Entries should not
check will accept them, but it leaves them out of its list. There are, be removed, even if the relevant Windows ID becomes obsolete or
after all, thousands of possible offset zones, but relatively few are switches to a different offset, as they make up the available zones of
widely used.) the UTC back-end. (That recognizes other offset zones, and its
is-available check will accept them, but it leaves them out of its
list. There are, after all, thousands of possible offset zones, but
relatively few are widely used.)
Note: -00:00 (without the UTC prefix) was introduced in RFC3339 as a Note: -00:00 (without the UTC prefix) was introduced in RFC3339 as a
way to indicate that a date-time has been converted to UTC but its use way to indicate that a date-time has been converted to UTC but its use
@ -51,6 +57,7 @@ utcIdList = (
('UTC-12:00', -43200), ('UTC-12:00', -43200),
('UTC-11:00', -39600), ('UTC-11:00', -39600),
('UTC-10:00', -36000), ('UTC-10:00', -36000),
('UTC-09:30', -34200),
('UTC-09:00', -32400), ('UTC-09:00', -32400),
('UTC-08:00', -28800), ('UTC-08:00', -28800),
('UTC-07:00', -25200), ('UTC-07:00', -25200),
@ -79,11 +86,14 @@ utcIdList = (
('UTC+07:00', 25200), ('UTC+07:00', 25200),
('UTC+08:00', 28800), ('UTC+08:00', 28800),
('UTC+08:30', 30600), ('UTC+08:30', 30600),
('UTC+08:45', 31500),
('UTC+09:00', 32400), ('UTC+09:00', 32400),
('UTC+09:30', 34200), ('UTC+09:30', 34200),
('UTC+10:00', 36000), ('UTC+10:00', 36000),
('UTC+10:30', 37800),
('UTC+11:00', 39600), ('UTC+11:00', 39600),
('UTC+12:00', 43200), ('UTC+12:00', 43200),
('UTC+12:45', 45900),
('UTC+13:00', 46800), ('UTC+13:00', 46800),
('UTC+14:00', 50400), ('UTC+14:00', 50400),
) )