Jump to content

Formatting UniversalTime as years, days, etc. of specific planet -> how to calculate length of year?


Recommended Posts

Hello fellow developers.

My savegame mod provides the option to place timestamps into the savegame names, that use either real time ("yyyyMMdd_hhmmss") or game time in "years_days_hhmmss".

Unfortunately there seems to be no formatting method out of the box, to format game time with leading zeroes for years and days, which is a requirement to chronologically sort the savegames based on a gametime timestamp. (Of course I could just use the game time in seconds, but that is rather nondescript for humans.)

So I guess I'll have to write my own formatting method for years and days. This method needs values for the length of a day and a year of the games "home" planet (so that people with modded solar systems and/or relocated space centers aren't left out). The CelestialBody class provides the data for the length of the day of a planet, but I can't find values for the length of the year?

I have searched the forums and api docs but can't seem to find anything the would be helpful for me. The most relevant thing I could find were discussions about the discrepancies between kerbins solar and sidereal days and years...

If someone could point me to some information that helps me to calculate the length of the year of a planet, it would make me very happy. :)

 

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...