KSP-KOS/KOS

kOS reports wrong time string under RP-1's real-world calendar.

Dunbaratu opened this issue · 1 comments

If you do this with RP-1 installed, it's waay off:

  print TIME():FULL.

It doesn't account for real-world messy calendar problems like leap years, leap seconds, or how you have to skip the leap year every 100 years, etc. (The problem isn't just with the string value of :FULL, but that's an easy way to demonstrate the problem. It's actually the calculation of year, day of year, etc that's wrong so it affects other things than just the string.)

The system kOS uses works in stock but NOT in the real-Earth calendar RP-1 uses.

There should be a forked path that alters the behavior of TimeBase.CalculateYear(), TimeBase.CalculateDay(), and so on, so it behaves differently if we're under the real-world calendar.

Since the real-world calendar problem is an enormous mess, in the real-world case, kOS should just leverage an already existing API for this instead of re-inventing the wheel. (But only in the forked path for real-world calendar. For stock game's calendar it should keep doing what it's doing now.)

Amendment: Check KSPUtil.PrintDate, which supposedly gets overridden to do it right when mods change the system. (Problem: the string isn't the issue, it's the side effect of the issue. The core issue is that Timestamp:year and Timestamp:::day aren't right either. See if KSPUtil has API routines to do that too.)