News for hackers. Stuff that matters.
Re:The Unix timestamp will begin with 16 this Sunday by BoppreH on Saturday September 12, 2020 @12:39PM (#24453644)
There is a very good reason to eventually abandon it: leap seconds. Unix time goes back one second whenever there is a leap second on Earth.

It's extremely weird and IMHO completely ruins the purpose of a timestamp, but it's a compromise for backwards compatibility, since Unix time was created before leap seconds. This hack ensures that the number of seconds in a day remains fixed, an assumption of many systems at the time.

Re:The Unix timestamp will begin with 16 this Sunday by JdeBP on Sunday September 13, 2020 @03:22AM (#24459073)
Leap seconds were introduced in 1972. The time_t that you are thinking of was invented somewhere around 1974, according to Unix historians.

Ironically, your kernel measures TAI time perfectly happily if unmolested, as that always ticks once for every SI second (ignoring oscillator drift). No slewing. No smearing. No stepping.

Re:The Unix timestamp will begin with 16 this Sunday by dylan604 on Saturday September 12, 2020 @02:30PM (#24454379)
Isn't a second just how long light takes to travel 299,792,458 m?

Also, "since Unix time was created before leap seconds." I found this interesting for the simple reason I've never spent any time thinking about Epoch vs Leap Second histories.

Re:The Unix timestamp will begin with 16 this Sunday by sltkr on Saturday September 12, 2020 @02:38PM (#24454423)
Yes, but the point is that the UNIX timestamp doesn't count the the number of seconds elapsed since January 1, 1970. It counts 86400 seconds per day, regardless of how many seconds the day actually has (which can vary due to leap seconds).
Re:The Unix timestamp will begin with 16 this Sunday by bitpow on Saturday September 12, 2020 @03:51PM (#24455032)
Is this accurate though? Isn’t the number of seconds since 1970 absolute, and it’s up to the library generating the Gregorian date to take into account leap seconds? I suppose if these libraries are not taking into account leap seconds, then the actual rollover will be a few seconds earlier (or later?) than what we think.
Re:The Unix timestamp will begin with 16 this Sunday by fanf2 on Saturday September 12, 2020 @04:28PM (#24455345)
See the definition of seconds since the epoch at https://pubs.opengroup.org/onlinepubs/9699919799.2018edition...

  tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86400 +
      (tm_year-70)*31536000 + ((tm_year-69)/4)*86400 -
      ((tm_year-1)/100)*86400 + ((tm_year+299)/400)*86400
Re:The Unix timestamp will begin with 16 this Sunday by JdeBP on Sunday September 13, 2020 @03:34AM (#24459134)
Your time_t isn't the true number of SI seconds since the Epoch. It's that number, mucked around 27 times so far. Instead of leaving their kernels to count one tick per SI second (ignoring oscillator drift) many people slew, step, or smear their seconds count every time that there is a leap second.

Go and read about "right" versus "posix" timezones.

* https://unix.stackexchange.com/a/294715/5132

Re:The Unix timestamp will begin with 16 this Sunday by Drdrdrq on Saturday September 12, 2020 @04:00PM (#24455117)
IIUC unix timestamp simply counts seconds (well defined interval of time) from epoch onwards. It is then up to different calendars to interpret this number as a given day / hour /... This is the beauty of it - it is always an accurate (well, at low speeds at least ;) ) measure of time. In other words, no, some days might not last 86400 seconds.
Re:The Unix timestamp will begin with 16 this Sunday by _-___________-_ on Sunday September 13, 2020 @12:44AM (#24458433)
This is not correct. UNIX timestamps always have 86400 seconds per day, and consequently, they do not actually count the number of seconds since the epoch.
Re:The Unix timestamp will begin with 16 this Sunday by Drdrdrq on Sunday September 13, 2020 @03:54PM (#24463461)
I stand corrected - thank you for the clarification!
Re:The Unix timestamp will begin with 16 this Sunday by TheArcane on Saturday September 12, 2020 @03:12PM (#24454717)
And meter itself is defined as the length of the path traveled by light in vacuum during a time interval of 1/299,792,458 of a second.

So it's cyclic and doesn't make sense outside the earth reference frame

Edit: since 2019, 1 second is defined by taking the fixed numerical value of the caesium frequency ∆νCs, the unperturbed ground-state hyperfine transition frequency of the caesium-133 atom, to be 9192631770 when expressed in the unit Hz, which is equal to s−1

So a second makes sense in the galactic scale at least as long as Caesium-133 is a stable isotope in that environment

Re:The Unix timestamp will begin with 16 this Sunday by jiofih on Saturday September 12, 2020 @03:30PM (#24454858)
> Since 1967, the second has been defined as exactly "the duration of 9,192,631,770 periods of the radiation corresponding to the transition between the two hyperfine levels of the ground state of the caesium-133 atom

> realisation of the metre is usually delineated (not defined) today in labs as 1579800.762042(33) wavelengths of helium-neon laser light in a vacuum

Re:The Unix timestamp will begin with 16 this Sunday by ztjio on Saturday September 12, 2020 @03:21PM (#24454791)
No. A second is "The duration of 9192631770 periods of the radiation corresponding to the transition between the two hyperfine levels of the ground state of the caesium-133 atom."
Re:The Unix timestamp will begin with 16 this Sunday by stan_rogers on Saturday September 12, 2020 @03:21PM (#24454789)
No, that's how the metre is defined. The second is defined by the transition between two hyperfine states of cesium 133 (9,192,631,770 'oscillations').
Re:The Unix timestamp will begin with 16 this Sunday by m-p-3 on Saturday September 12, 2020 @01:11PM (#24453854)
Or lets say we colonize a planet with a significant time dilation (ie near a supermassive blackhole), how do you deal with this? Who has the canonical time?
Re:The Unix timestamp will begin with 16 this Sunday by flopunctro on Saturday September 12, 2020 @02:41PM (#24454443)
AFAIK, there is no canonical time in relativity. There is the "local time", which is what your wristwatch shows, and the "time in place X", where X can be Earth, Mars, or some spaceship. These times might not be in sync, and they might even be distorted. Because, if place X is moving relative to you at a significant percentage of lightspeed, their seconds will be longer. Also, the further X is, the blurrier the concept of simultaneity becomes. Which makes the question "what time is it _now_ in place X" moot :)
Re:The Unix timestamp will begin with 16 this Sunday by numpad0 on Saturday September 12, 2020 @03:09PM (#24454686)
If relativity don’t allow time travel doesn’t it make time canonical? A clock on Earth from telescope might look jumpy but only in forward direction after compensating for distance I think
Re:The Unix timestamp will begin with 16 this Sunday by flopunctro on Saturday September 12, 2020 @03:25PM (#24454823)
Looking at a clock from Earth through a telescope isn't as straightforward as you'd think. The image you see of that clock is actually light (photons) emitted from Earth, which will take a while to reach you - like, 1 year, if you're 1 lightyear away. During that year, Earth has moved on, maybe blew itself apart. But you can't even tell, because information can't reach you faster than light :) So you can only see Earth's past, not Earth's "now". The further you are, the more "now" loses meaning.
Re:The Unix timestamp will begin with 16 this Sunday by numpad0 on Saturday September 12, 2020 @04:59PM (#24455613)
Yeah but can it ever go back, other than by backing off faster than the speed of light? If it can’t then it’s at least monotonic, even if it’s not rate constant
Re:The Unix timestamp will begin with 16 this Sunday by dodobirdlord on Sunday September 13, 2020 @02:37AM (#24458887)
All observers observer all clocks to advance monotonically forward in time, regardless of their location or relative speed, unless the clock is moving at the speed of light. But the rate that each clock is observed to advance at depends on things like relative speed, acceleration, and the curvature of spacetime.
Re:The Unix timestamp will begin with 16 this Sunday by JdeBP on Sunday September 13, 2020 @03:47AM (#24459192)
... unless it's the system clock in Linux, with the hardware RTC set to be interpreted as local time, and one is watching a system boot on a machine that is set up as east of the Prime Meridian (i.e. the hardware RTC is ahead of UTC). (-:

* https://unix.stackexchange.com/a/600490/5132

Re:The Unix timestamp will begin with 16 this Sunday by dodobirdlord on Sunday September 13, 2020 @01:35PM (#24462506)
Given that Unix time specifically doesn’t handle leap seconds, a system clock is not a clock by the conventional definition.
Re:The Unix timestamp will begin with 16 this Sunday by ColanR on Saturday September 12, 2020 @01:33PM (#24454018)
We'll probably come up with something similar to time zones once we become an interplanetary species.

"Local seconds since 1970", vs. "Static seconds since 1970".

Re:The Unix timestamp will begin with 16 this Sunday by JdeBP on Sunday September 13, 2020 @03:41AM (#24459168)
You don't have to go to science fiction for this. Science fact will do. On Earth, with Atomic Time, we already have to account for general relativistic effects. Doco from the BIPM (the SI Brochure) already talks about accounting for them across the sizes of the measuring devices.
Re:The Unix timestamp will begin with 16 this Sunday by Dylan16807 on Saturday September 12, 2020 @01:32PM (#24454000)
You'd just use some math to remove the influence of the black hole. Or for a more hands-on answer, you could have some reference beacons that are significantly further away from the black hole.

In a broad sense, the answer goes like this: Almost everything in the galaxy shares an approximate reference frame when it comes to velocity and special relativity. For general relativity and gravity, that's obviously a distortion so it doesn't count.

In the long term, to prevent very minor drift, we can use quasars as a reference.

Re:The Unix timestamp will begin with 16 this Sunday by iso1210 on Saturday September 12, 2020 @12:54PM (#24453741)
Why would someone on Mars, or an asteroid, or orbiting venus, care about leap seconds on earth?

Number of seconds since a given time seems fine until we're travelling significantly outside of a common reference plane.

Re:The Unix timestamp will begin with 16 this Sunday by beagle3 on Saturday September 12, 2020 @12:59PM (#24453770)
That’s exactly why op said we should abandon Unix time. The “who cares about leap seconds” standards is called TAI, and the difference between TAI and Unix time changes every time a leap second is introduced.

Unix time decrees every day has exactly 86400 seconds. But the introduction of leap seconds means that While most days have 86400, some earth days have 86401 seconds and potentially there could also be days with 86399

TAI makes sense everywhere, Unix time only on earth.

Re:The Unix timestamp will begin with 16 this Sunday by BoppreH on Saturday September 12, 2020 @01:00PM (#24453786)
Because that's not how Unix time is defined. The leap second hack is hardcoded into it:

Unix time is [...] the number of seconds that have elapsed since the Unix epoch, minus leap seconds.

- Wikipedia

If you are on Mars you'll have to update your computer time every ~6 months when Earth release a new table of leap seconds caused by e.g. earthquakes.

Re:The Unix timestamp will begin with 16 this Sunday by Dylan16807 on Saturday September 12, 2020 @01:25PM (#24453949)
Or we just pretend they never happened.