-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a C# class PrincipiaTimeSpan to gather time formatting and parsing #2539
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested in game with stock
Have you tested both the 24h and 6h day stock settings?
Done.
ksp_plugin_adapter/time_span.cs
Outdated
} | ||
|
||
public static int day_duration => date_time_formatter.Day; | ||
public static string day_symbol => is_stock_day ? "d6" : "d"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public static string day_symbol =>
hour_divides_day && !is_si_time
? "d" + (int)(date_time_formatter.Day / date_time_formatter.hour)
: "d";
private static bool hour_divides_day =>
(int)(date_time_formatter.Day / date_time_formatter.hour) * date_time_formatter.hour ==
date_time_formatter.Day;
private static is_si_time =>
date_time_formatter.Minute == 60 &&
date_time_formatter.Hour == 60 * 60 &&
date_time_formatter.Day == 24 * 60 * 60;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I made the change, and I found the output with JNSQ unnecessarily noisy:
014 d12 00 h 00 min
So I changed it again to only display one digit after d
. Thus d3
, d6
, d9
but just d
for JNSQ.
Make it use the correct KSP APIs to figure out the length of the day, etc. Tested in game with stock and JNSQ.
Fix #2520.