Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens to milliseconds since epoch when daylight savings time begins/ends?

Milliseconds since epoch represents the number of milliseconds that have elapsed since 1970. At the instant before daylight savings time ends, or when we set the clocks back to 1:00 from 2:00, do the milliseconds since epoch fall back as well, or do they continue?

Another question: If I live in California, US, which is on Pacific (Daylight/Standard) Time, is the milliseconds since epoch the same there as it is in, say, New York, on Eastern (Daylight/Standard) Time?

like image 981
vcapra1 Avatar asked Nov 02 '14 12:11

vcapra1


People also ask

What happens to the clock when daylight savings ends?

Daylight saving time then ends on the first Sunday in November, when clocks are moved back an hour at 2 a.m. local daylight time (so they will then read 1 a.m. local standard time). In 2021, DST ended on Nov. 7 in the U.S., when most Americans set the clock back an hour, and the cycle will began again.

What is milliseconds since epoch?

The number of milliseconds since the "Unix epoch" 1970-01-01T00:00:00Z (UTC). This value is independent of the time zone. This value is at most 8,640,000,000,000,000ms (100,000,000 days) from the Unix epoch. In other words: millisecondsSinceEpoch.

Does time go slower after daylight savings?

A bit. When we shift clocks forward one hour in the spring, many of us will lose that hour of sleep. In the days after daylight saving time starts, our biological clocks are a little bit off. It's like the whole country has been given one hour of jet lag.

Is epoch time in seconds or milliseconds?

In computing, Unix time (also known as Epoch time, Posix time, seconds since the Epoch, Unix timestamp or UNIX Epoch time) is a system for describing a point in time. It is the number of seconds that have elapsed since the Unix epoch, excluding leap seconds. The Unix epoch is 00:00:00 UTC on 1 January 1970.


2 Answers

Milliseconds since the UNIX epoch (January 1, 1970 00:00:00 UTC) aren't affected by daylight savings and timezones as J. van Dijk mentioned.

To answer your 2nd question explicitly, which i think is important to understand UTC itself: if 2 people call System.currentTimeMillis() in Java or new Date().getTime() in Javascript at the same time, one of them being in California and one of them being in New York they should get the same number of milliseconds.

like image 120
Sandman Avatar answered Sep 16 '22 11:09

Sandman


The milliseconds since epoch are not influenced by timezones and daylight saving time (daylight saving time just changed the timezone with -1 / +1).

The milliseconds/seconds since epoch are (always?) in UTC (or GMT + 0).

like image 36
J. van Dijk Avatar answered Sep 18 '22 11:09

J. van Dijk