I need to compare the timestamp given by my backend (which is in Perl) and the timestamp of by front-end (which is in JS), so I need to be sure that they both use the same time unit.
For JS it's easy, quoting:
A number representing the milliseconds elapsed between 1 January 1970 00:00:00 UTC and the given date.
For Perl, the documentation about $dt->epoch()
says:
Return the UTC epoch value for the datetime object. Datetimes before the start of the epoch will be returned as a negative number.
The return value from this method is always an integer.
Since the epoch does not account for leap seconds, the epoch time for 1972-12-31T23:59:60 (UTC) is exactly the same as that for 1973-01-01T00:00:00.
To me, it's not clear if the returned integer is in milliseconds or seconds (in the second case I would need to convert JS epoch in seconds or viceversa).
Which one is correct?