Jump to content

max number of year?


lammatt

Recommended Posts

That's not how it works. The precision of your variables doesn't automatically increase because you're targeting a platform with a 64-bit address range instead of a 32-bit address range. If you're specifically using a 64-bit or 32-bit int, it'll still have the same level of precision on a 64-bit or a 32-bit compile.

I know the difference between unsigned long and signed int, I was just trying to give a best possible explanation without confusing the poor lad or having to give a free semester of computer science.

Link to comment
Share on other sites

also, to touch on the 2038 "problem" - it wouldn't be a problem if a new epoch was started in 2030, and use a single bit to note which epoch the system uses, until all systems have moved away from the 1970 epoch, but I expect that by 2038, home computers will be using 512 bit standards, so the problem will become moot either way.

The problem isn't in what "standard" a computer uses. The problem is in what kind of variable declaration the application does. This also reflects on storage in databases and the like. Also, simply saying 'bit 0 defines which epoch the date is in' isn't going to work either. You need to modify all the software that uses these timestamps to understand this entire concept of an epoch. When you're going about touching all the software anyway, might as well give it a proper fix and introduce a 64-bit value for timestamps (which gives 5.8x10^11 years - well beyond the expected lifetime of our sun)

Link to comment
Share on other sites

Not to derail the thread by bringing it slightly closer to the original question, but I'm curious: how did people become convinced KSP is using a 32-bit int of seconds to track time? I've never modded KSP so I'm less familiar with this DLL than some, but if I just pop open KSP's "KSP_Data\Managed\Assembly-CSharp.dll" with Visual Studio's object browser, I'm seeing a lot of methods and members like this:


public double UniversalTime { get; } ... Member of Game
public static double GetUniversalTime() ... Member of Planetarium
public void WarpTo(double UT, double maxTimeWarping = 8, double minTimeWarping = 2.5) ... Member of TimeWarp
public double TimeDeadline ... Member of Contracts.Contract
public double missionTime ... Member of Vessel
public Vector3d getOrbitalVelocityAtUT(double UT) ... Member of Orbit

It's possible I'm being misled as I'm not familiar with their codebase, but from the above, it sure looks like they are, as a rule, using doubles to track time for anything that could possibly work over large timescales (UT, mission time, etc.). But this evidence aside, clearly KSP cannot use an integer number of seconds for its time tracking, since the simulation obviously works at a subsecond resolution.

Link to comment
Share on other sites

Yes, KSP uses a double-precision floating point number to track time. The display of the time seems to be rounding it to a 32-bit int value of seconds and then converting that to years/months/days/etc.

Here's an easier version: Computers store values in memory. Memory is divided up into fixed-size "blocks", each block can hold a certain number of digits. When you keep track of a value you really just keep track of which block it's stored in. So if you have a 5-digit block storing an integer, you can store at most 99999. If you need to store 100000, you can't. KSP keeps track of time with such a block, so when it goes for too long you run out of space and things go screwy. There are ways to make things not run out of space but they make things slow. Since time is used for all the physics calculations you can't afford to make that slow. You can also ask for a bigger block when you first store the value, but that's up to the developers.

Link to comment
Share on other sites

Regarding the question of what happens past N Year, I think this guy has the answer....

o, if you left the kerbin system at 64 km/sec, the speed of light is about 300,000 km/sec... You are travelling .02% of the speed of light. 4687 times slower than light... So your kerbals endured a trip that took 4687 years, to travel 1 light year.

https://www.reddit.com/r/KerbalSpaceProgram/comments/3endsw/in_february_i_began_a_project_to_fly_a_crew_of/

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...