From c20a1e7b8f269443afb77ff4451f2c47fa55cb00 Mon Sep 17 00:00:00 2001 From: Andrew Paprocki Date: Tue, 20 Mar 2018 12:33:54 +0000 Subject: [PATCH] Editorial: LocalTZA input specification (#1160) The `LocalTZA` implementation-defined algorithm must accept the full range of `Number` and not define its input to be a *time value* because the algorithm is specified to take an already offset local time that can be outside of the time value range. This cleans up the specification text to clearly distinguish UTC time values versus local time `Number` inputs and uses the same subscript notation for both UTC and local time to make the text more clear. --- spec.html | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/spec.html b/spec.html index 72dc5fbad1..48af6055ed 100644 --- a/spec.html +++ b/spec.html @@ -26994,15 +26994,17 @@

Week Day

LocalTZA ( _t_, _isUTC_ )

-

LocalTZA( _t_, _isUTC_ ) is an implementation-defined algorithm that must return a number representing milliseconds suitable for adding to a Time Value. The local political rules for standard time and daylight saving time in effect at _t_ should be used to determine the result in the way specified in the following three paragraphs.

-

When _isUTC_ is true, LocalTZA( _t_, true ) should return the offset of the local time zone from UTC measured in milliseconds at time represented by time value _t_ (UTC). When the result is added to _t_ (UTC), it should yield the local time.

-

When _isUTC_ is false, LocalTZA( _t_, false ) should return the offset of the local time zone from UTC measured in milliseconds at local time represented by time value _t_local = _t_. When the result is subtracted from the local time _t_local, it should yield the corresponding UTC.

-

When _t_local represents local time repeating multiple times at a negative time zone transition (e.g. when the daylight saving time ends or the time zone adjustment is decreased due to a time zone rule change) or skipped local time at a positive time zone transitions (e.g. when the daylight saving time starts or the time zone adjustment is increased due to a time zone rule change), _t_local must be interpreted with the time zone adjustment before the transition.

+

LocalTZA( _t_, _isUTC_ ) is an implementation-defined algorithm that returns the local time zone adjustment, or offset, in milliseconds. The local political rules for standard time and daylight saving time in effect at _t_ should be used to determine the result in the way specified in this section.

+

When _isUTC_ is true, LocalTZA( _t_UTC, true ) should return the offset of the local time zone from UTC measured in milliseconds at time represented by time value _t_UTC. When the result is added to _t_UTC, it should yield the corresponding Number _t_local.

+

When _isUTC_ is false, LocalTZA( _t_local, false ) should return the offset of the local time zone from UTC measured in milliseconds at local time represented by Number _t_local. When the result is subtracted from _t_local, it should yield the corresponding time value _t_UTC.

+

Input _t_ is nominally a time value but may be any Number value. This can occur when _isUTC_ is false and _t_local represents a time value that is already offset outside of the time value range at the range boundaries. The algorithm must not limit _t_local to the time value range, so that such inputs are supported.

+

When _t_local represents local time repeating multiple times at a negative time zone transition (e.g. when the daylight saving time ends or the time zone offset is decreased due to a time zone rule change) or skipped local time at a positive time zone transitions (e.g. when the daylight saving time starts or the time zone offset is increased due to a time zone rule change), _t_local must be interpreted using the time zone offset before the transition.

If an implementation does not support a conversion described above or if political rules for time _t_ are not available within the implementation, the result must be 0.

It is recommended that implementations use the time zone information of the IANA Time Zone Database https://www.iana.org/time-zones/.

1:30 AM on November 5, 2017 in America/New_York is repeated twice (fall backward), but it must be interpreted as 1:30 AM UTC-04 instead of 1:30 AM UTC-05. LocalTZA(TimeClip(MakeDate(MakeDay(2017, 10, 5), MakeTime(1, 30, 0, 0))), false) is -4 × msPerHour.

2:30 AM on March 12, 2017 in America/New_York does not exist, but it must be interpreted as 2:30 AM UTC-05 (equivalent to 3:30 AM UTC-04). LocalTZA(TimeClip(MakeDate(MakeDay(2017, 2, 12), MakeTime(2, 30, 0, 0))), false) is -5 × msPerHour.

+

Local time zone offset values may be positive or negative.

@@ -27013,18 +27015,19 @@

LocalTime ( _t_ )

1. Return _t_ + LocalTZA(_t_, *true*). -

Two different time values (_t_ (UTC)) are converted to the same local time tlocal at a negative time zone transition when there are repeated times (e.g. the daylight saving time ends or the time zone adjustment is decreased.).

+

Two different input time values _t_UTC are converted to the same local time tlocal at a negative time zone transition when there are repeated times (e.g. the daylight saving time ends or the time zone adjustment is decreased.).

+

LocalTime(UTC(_t_local)) is not necessarily always equal to _t_local. Correspondingly, UTC(LocalTime(_t_UTC)) is not necessarily always equal to _t_UTC.

UTC ( _t_ )

-

The abstract operation UTC with argument _t_ converts _t_ from local time to UTC. It performs the following steps:

+

The abstract operation UTC with argument _t_ converts _t_ from local time to UTC by performing the following steps:

1. Return _t_ - LocalTZA(_t_, *false*). -

UTC(LocalTime(_t_)) is not necessarily always equal to _t_. LocalTime(UTC(_t_local)) is not necessarily always equal to _t_local, either.

+

UTC(LocalTime(_t_UTC)) is not necessarily always equal to _t_UTC. Correspondingly, LocalTime(UTC(_t_local)) is not necessarily always equal to _t_local.