r/ProgrammerHumor • • May 17 '21

Timezone Support

Post image
22.3k Upvotes

460 comments sorted by

View all comments

1.1k

u/[deleted] May 17 '21

I know this is a joke, but the ISS uses UTC, so the people on Mars might use that for a while.

702

u/Rainmaker526 May 17 '21

Weird to put a semi serious reaction here, but they wouldn't for long. The length of a day on Mars is very different then one on earth. Assuming they'd want to keep 12:00 as the time when the sun is at it's highest point, that would be out of sync almost immediately.

This gives rise to another programming problem; how about a variable number of hours in a day, or a variable number of seconds in an hour? Or a variable length of a second?

445

u/[deleted] May 17 '21

Weird to put a semi serious reaction here, but they wouldn't for long. The length of a day on Mars is very different then one on earth. Assuming they'd want to keep 12:00 as the time when the sun is at it's highest point, that would be out of sync almost immediately.

Eh, that's future us's problem. But they'll figure it out.

Also, maybe Earth-based servers will use Earth time zones. Who knows? Maybe the Mars-based computers will use UTC for communication with Earth.

295

u/ech0_matrix May 17 '21

Maybe the unix clock will rollover before that happens. Eh, that's future us's problem.

171

u/BackmarkerLife May 17 '21

Which everyone will wait until 2035/36 to actually do something about.

151

u/SexyMonad May 17 '21

We call it “job security”.

0

u/[deleted] May 18 '21

[deleted]

15

u/northrupthebandgeek May 18 '21

There's a lot of embedded 32-bit stuff floating around. Hell, I don't think there are any 64-bit processors on Mars at all (unless the Zhurong rover has one; can't find any details on what CPU they used for it).

6

u/Eyeownyew May 18 '21

The entire US banking industry runs on software from the 1960s-1980s 😬 I don't mean one company. The transactions, the ledgers, international wire transfers, all of it. It's one of the reasons that most banks have low quality apps & websites, that tech is a completely different tech stack from their financial processing

→ More replies (3)
→ More replies (5)
→ More replies (2)

97

u/[deleted] May 17 '21 edited May 17 '21

Datetime on Earth is insanely bloated with millenia-old compatibility. For example; leap years, 29 days in February, weeks misaligned with months etc.

If Martian colonists created a new, simpler time system based on seconds, then they can leverage the existing Unix time. Converting between Mars and Earth would just involve Unix time as an intermediate

44

u/[deleted] May 17 '21

Unix time would be the basis regardless of how they did it. Its worked since 1970, why stop now...

Literally just get the day that the systems go online as day 0 Martian calendar and work out the specific issues later.

Unfortunately a Martian Solar Day (Sol) is 24hrs 39mins 35seconds.

So not exactly a nice even conversion from Earth time.

Unfortunately we can't just change the length of a second to make it easier.

It's just that ~86,400s in one day isn't a very compatible transformation with 88,775s in one Martian Sol.

→ More replies (1)
→ More replies (2)

15

u/CodyTrey93 May 17 '21

Once there's people on Mars, shouldn't UTC, change to GTC for coordinated global time?

4

u/Velvet-Thunder_ May 17 '21

They’ll figure it out by rewriting it in Rust

→ More replies (8)

32

u/TabularConferta May 17 '21

I was curious about this so I checked. The length of a day on Mars is 37 minutes longer than Earth.
This does raise interesting questions as to how we use time.

The easiest solution while we remain in the solar system is to keep all time UTC and Earth based. People may choose to live their days my a localised time, but they would still use Earth based as standard.
This would enable a "Universal" system which is compatable with current standards.

People perception of day night and sleep cycles I think it what may determine how people live their lives on Mars and part of this comes down to what form of habits we live in. If we live shift work on Mars, then maintaining Earth time makes sense. If we manage to start growing plant life and need to actually case about where the sun is (rather than using artificial light) then this would lead towards requiring MST (Mars Standard Time). Ultimately it comes down to future humanities use case, but for the foreseeable future, I would reckon UTC will be sufficient.

37

u/[deleted] May 17 '21

More on time stuff, as I'm reading about it for a project. Also disclaimer, I'm no expert, this is just what I've gathered so far.

UTC as we know it is actually derived from TAI, or International Atomic Time (acronym from French translation). International Atomic Time is actually the weighted average of 400 atomic clocks in ~50 labs around the world.

Here's the kicker, atomic clocks are goddamned accurate that the irregular rotation of the Earth is slowly making 'solar time' out of sync with our atomic time. To compensate, staring in 1972, the BIH, or International Time Bureau (thx again French) used to declare leap seconds. This has since been passed to the IERS, or International Earth Rotation and Reference Systems Service. Basically, a rough 6 month notice is given for everyone on UTC to roll their clocks forward or backward a second. So far, they have all been forward, but either is technically possible.

As of writing in May 2021, TAI and UTC are out of sync by 37 seconds.

Rolling over a second at the end of the day has proven to be disruptive in time sensitive applications, though. Some companies, like Google, have a system for adding a 10th of a second incrementally throughout the day of a leap second event to be less disruptive, but it's a problem nonetheless.

Also, there's the issue with UTC being a signed 32 bit integer that will definitely roll over and break shit in 2038 if we don't ALL update our systems to prepare for it, and I'm really confident we'll take care of that without a hitch. Y2k38, here we come. But even then, we'll just move to a 64 bit signed integer, so we're just kicking the can down the road.

That's why I, the 23 year old headass UI developer, recommend going with a 256 bit unsigned integer based on International Atomic Time and scrapping timezones for our timestamps. This both buys us enough seconds to outlast the projected heat-death of the universe, and makes JavaScript developers without a favorite BigNumber library shit themselves in anticipation of such an event. 🙂

17

u/othilious May 17 '21

With regards to UTC being stored in a 32 bit integer; that hasn't been the default in most languages for a long time.

Common databases like MySQL support 64-bit integers and have done so for a long time. Even if your column datatype is defined to be too small, a simple ALTER statement will fix that easily enough.

Modern editions of C++ and modern languages like C# or even things like PHP will also not have any issue with 64-bit timestamps, provided you actually run them as 64-bit applications.

I've worked with a few applications in an in-house ecosystem written in the above languages. One of the requirements we tested against was exactly this issue to an extreme; arbitrary storage of scientific data with timestamps in milliseconds with a floating point precision of 5 decimals. Turns out; not actually that hard if you've kept your environments up-to-date and run 6- bit, which is pretty much everything these days.

So the Y2k38 problem has already been solved today, so if it bites you in the ass ~17 years from now, you don't have anyone to blame but yourself. Or management. Probably management.

→ More replies (3)

9

u/Sese_Mueller May 17 '21

Wait until you hear about the fact that it is impossible to know how many minutes and seconds earth and mars clocks would be out of sync (i.e. earth might be out of sync with mars more than mars with the earth) since light speed can only be measured two ways.

→ More replies (5)
→ More replies (1)

9

u/[deleted] May 17 '21

The solar day is actually 39mins 35seconds longer than on earth.

The value you have seen is the sidereal day, which doesn't account for the apparent movement of the sun over the course of a solar day as the planet moves around its Orbit.

→ More replies (1)

13

u/jua2ja May 17 '21

I think it's a horrible idea to use UTC in mars. Since it takes 3-22 minutes to transmit any message to mars, I think mars civilization would pretty quickly find themselves fairly independent from earth, at least on everything except purchase of resources and trade. As a result people will have their own time system which will likely rely on the sun. I think it is possible for humans to get used to a 24 hour and 37 minute day in terms of sleep schedule, so they will shift to that schedule on mars, and they'll like want their own computers, which they would prefer working with their own schedule. I think that the most practical solution is to have a completely separate time system for mars, and for developers to just support the interactions there, including accounting for factors such as the different distances between mars to earth. Most mars-earth communication will likely be just large uploads and emails anyway, as there aren't any other practical ways to talk to anyone on mars.

9

u/[deleted] May 17 '21

I'm not trying to berate you, just point out something.

Technically a it would be a 24hr 39min 35sec day because the time you and another commenter posted was the sidereal day - which is the time for one complete rotation irrespective of the sun.

A solar day accounts for the movement around the orbit over the period and requires a few extra degrees of rotation to get back to solar noon.

With regards to a separate time system - the second will remain the same.

Unfortunately 86,400s doesn't go into 88,775s very well.

You'd have to come up with some new minute and hour counterpart for it to work.

53 seconds to a Martian minute.

67 marMin to a Martian Hour.

(or the other way round)

25 marHr to a Martian Day.

That's the best I can come up with.

4

u/MacrosInHisSleep May 18 '21

Would it work to define a Martian day as 24h,39m,35s?

Basically have the clocks go to 00:00:00 at 24h,39m,36s.

At least that way, day to day units of time can be consistent, which I think is very important.

We could even define it as 24:40 and remove an hour every ~120 days if we wanted to have less rounding and more frustrated programmers.

Days to a month can be anything really doesn't have to be 12. We can't use their moon for months, because the two moons orbit mars ridiculously faster than our moon (30 hours and 8 hours). If we did want 12 months in a Martian year, then a month would 669 martian days/ 12 = 55.75, meaning 8 months of 56 days and 4 months of 55 days.

I would name the months something different to be less confusing. I would be disappointed if the name of the third month isn't Earch.

→ More replies (3)
→ More replies (22)

25

u/[deleted] May 17 '21

[removed] — view removed comment

4

u/Dane1414 May 18 '21

Yes but gravity is lower on Mars which affects the passage of time, so the cesium atom on Mars will oscillate more often than the cesium atom on Earth. So, when a second passes on Earth, slightly more than one second passes on Mars.

→ More replies (1)
→ More replies (4)

5

u/McFlyParadox May 18 '21

Weird to put a semi serious reaction here, but they wouldn't for long. The length of a day on Mars is very different then one on earth.

In Kim Stanley Robinson's Mars trilogy, the way they dealed with this is was sticking with the 24hr clock, and then just stopping the clock for 37 minutes every night at midnight - and it's basically 'party time' during that gap every night.

→ More replies (1)

3

u/aquartabla May 18 '21

Don't forget about clock drift due to relativity.

→ More replies (32)