Skip to content
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

Merged
merged 6 commits into from
Apr 22, 2020

Conversation

pleroy
Copy link
Member

@pleroy pleroy commented Apr 20, 2020

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.

Copy link
Member

@eggrobin eggrobin left a 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.

}

public static int day_duration => date_time_formatter.Day;
public static string day_symbol => is_stock_day ? "d6" : "d";
Copy link
Member

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;

Copy link
Member Author

@pleroy pleroy Apr 21, 2020

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.

ksp_plugin_adapter/orbit_analyser.cs Outdated Show resolved Hide resolved
@eggrobin eggrobin added the LGTM label Apr 21, 2020
@pleroy pleroy merged commit 3957b99 into mockingbirdnest:master Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add daylength tweakable
2 participants