getdate() page has several issues. It should be overhauled
Reported by Samuel GOUGEON (@sgougeon)
BUG DESCRIPTION:
----------------
Information in getdate() page is sometimes unclear, sometimes wrong, sometimes incomplete:
* getdate() returns the computer's time. So it includes the time zone shift and the possible Daylight saving time shift. This is not documented.
* getdate("s"): contrarily to what is documented, the answer does not take leap seconds into account.
It is current written "returns a scalar with the number of seconds since Jan 1, 1970, 00:00 UTC (Unix Time Convention)
Please note that the return value contains the leap seconds."
But the Unix Time Convention *ignores* leap seconds (https://en.wikipedia.org/wiki/Unix_time).
There might be a confusion between "Unix Time Convention" (that is the current getdate() behavior) and
"Universal Time Coordinated" (https://en.wikipedia.org/wiki/Coordinated_Universal_Time) that actually takes leap seconds into accounts.
Proof that getdate("s") does not take leap seconds into account:
--> tm = getdate(); ts = getdate("s");
--> (datenum(tm([1 2 6 7 8 9])) - datenum([1970 1 1 0 0 0]))*86400 - ts
ans =
7200.000001431
This difference is exactly 2h00mn00s (time zone + daylight saving time shift).
datenum() does not take leap seconds into account. So if getdate("s") was taking leap seconds into account,
they would appear in this difference (27 s since 1970).
* getdate(x) returns the datetime corresponding to the number x of second elapsed from 1970-01-01 00:00:00 GMT to now,
**expressed in the current computer's time zone**. This is why
--> getdate(0)
ans =
1970. 1. 1. 1. 5. 1. 1. 0. 0. 0.
^^^
show a shift of 1h00mn00s, because the time zone of my computer is in advance of 1h00 wrt GMT.
The comment helps a bit in en_US, but is very obscur in the fr_FR version.
* Reciprocally, getdate("s") returns the number of seconds elapsed from the 1970-01-01 00:00:00 **GMT** to now.
HOW TO REPRODUCE THE BUG:
-------------------------
tm = getdate(); ts = getdate("s");
(datenum(tm([1 2 6 7 8 9])) - datenum([1970 1 1 0 0 0]))*86400 - ts
getdate(0)
OTHER INFORMATION:
------------------
https://help.scilab.org/docs/6.1.0/en_US/getdate.html