Skip to content

Commit 353f60c

Browse files
tmr-glenkis
authored andcommitted
datetime: refined leap second support desc
1 parent 4ce641a commit 353f60c

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

doc/reference/reference_lua/datetime.rst

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Functions
118118
- 0
119119

120120
* - sec
121-
- Seconds. Value range: 0 - 60. A leap second is supported, see a section :ref:`leap second <leap-second>`.
121+
- Seconds. Value range: 0 - 60. A leap second is supported at the most basic level, see the section :ref:`leap second <leap-second>`.
122122
- number
123123
- 0
124124

@@ -267,7 +267,7 @@ Functions
267267

268268
By default fields that are not specified are equal to appropriate values in a Unix time.
269269

270-
Leap second is supported, see a section :ref:`leap second <leap-second>`.
270+
Leap second is supported at the most basic level, see the section :ref:`leap second <leap-second>`.
271271

272272
:param string input_string: string with the date and time information.
273273
:param string format: indicator of the ``input_string`` format.
@@ -1099,7 +1099,7 @@ that besides the time zone description files also contains a leapseconds file.
10991099
You can use the Lua module :ref:`tarantool <tarantool-module>` to get a used
11001100
version of ``tzdata``.
11011101

1102-
This section describes how the ``datetime`` module supports leap seconds:
1102+
The ``datetime`` module supports leap seconds at the most basic level:
11031103

11041104
* The function :ref:`datetime.parse() <datetime-parse>` correctly parses
11051105
an input string with 60 seconds:
@@ -1122,6 +1122,27 @@ This section describes how the ``datetime`` module supports leap seconds:
11221122
- 1970-01-01T00:01:00Z
11231123
...
11241124
1125+
Meanwhile the following cases are NOT supported by the ``datetime`` module:
1126+
1127+
* With the :ref:`datetime.new() <datetime-new>` function, the 60 leap seconds in the ``sec`` key
1128+
give an extra minute like regular seconds, and the result is represented in a regular manner,
1129+
without leap seconds:
1130+
1131+
.. code-block:: tarantoolsession
1132+
1133+
datetime.new({ year = 1998, month = 12, day = 31, hour = 23, min = 59, sec = 60})
1134+
---
1135+
- 1999-01-01T00:00:00Z
1136+
1137+
* The function :ref:`datetime.parse() <datetime-parse>` produces an error when parsing a leap second
1138+
input string with 60 seconds and a format that supports leap seconds ('rfc3339', 'iso8601'):
1139+
1140+
.. code-block:: tarantoolsession
1141+
1142+
datetime.parse('1998-12-31T23:59:60Z', {format='rfc3339'})
1143+
---
1144+
- error: 'builtin/datetime.lua:885: could not parse ''1998-12-31T23:59:60Z'''
1145+
11251146
.. _timezone:
11261147

11271148
Time zones

0 commit comments

Comments
 (0)