If I wanted to work using dates and times going millions of years into the past / future, how would I do it?

If I wanted to work using dates and times going millions of years into the past / future, how would I do it in C / C ++ / C #?

For example, I’ll say that I worked on an algorithm to see if a comet is about to hit the ground? Are there commercial or open libraries?

Most DateTime values ​​only work for a few years. Unixes will end only in 2038!

Tony

+3
source share
9 answers

Astronomers use their own calendar, different from the civil, Gregorian calendar.

Astronomical Julian dates are what they use.

Take a look at http://en.wikipedia.org/wiki/Julian_day

Here's a typical package: Solar Clock .

+7
source

You cannot work out future UTC dates until the second, due to the existence of leap seconds (one of which is scheduled for December 31, in a couple of weeks). No one knows when leap seconds will be added to the calendar, because no one knows the speed at which the Earth’s rotation will continue to slow down in the future.

+6
source

Well, not to be dumb or anything else, but if he hits the ground after about 1700 years, I don’t think we need to know the actual date.

If it's not Tuesday.

Could never get to hang.

+5
source

If the time range suggested by typical datetime variables is too small, you have two options:

  • Using a variable with a large volume (i.e. a large number of bits)
  • Resolution for less accuracy

Which one to choose depends on what exactly you want to do. But in general, my advice is option number 2. When we talk about centuries or millennia, milliseconds are usually not that important ...

+4
source

When it comes to astronomical events, it does not matter how much of the earth is facing the Sun, that is, it has daylight. Therefore, calendars and dates do not matter. You should just use the time. 64 bits of time_t are enough.

Even when you use time, keep in mind that three-body systems (like Earth-Sun-Jupiter) are chaotic. The prediction of the position of the Earth in the distant future has a rather large error.

+1
source

64-bit time_t will work up to 292,277,026,596.

+1
source

You just need more bits to save this value and / or use larger time increments to represent by timestamp. Instead of ms, do the years, and then maybe use a math / API library designed for very large numbers if that is not enough (and depending on your accuracy requirements) or use floating points.

0
source

The DateTime object in C # goes from 1.1.0001 to 12.31.9999. This is even more limited in SQL Server, where the earliest date is something like 1735.

To a large extent, you will have to write something or try to curse something from someone else. Going forward is probably easier (except for the second jump). There is pretty good calendar information here .

0
source

I think the problem is not whether the comet is about to hit Friday or Sunday, but if the comet will or will not hit. I assume this means that you could model the time in 1000s as a 64-bit long type. You can solve 213 billion years. Then you can create a routine that maps this back to the full dates value ...

0
source

All Articles