From f0ee37c8e19ec50bbe15fa387feb3b450400bb85 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 12 May 2020 00:41:25 +0900 Subject: [PATCH] Use dateTimeFormatter for time period lengths This makes WaypointManager compatible with planet mods that alter Kerbin's day length and use Kronometer. --- .../WaypointManager/WaypointFlightRenderer.cs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/source/WaypointManager/WaypointFlightRenderer.cs b/source/WaypointManager/WaypointFlightRenderer.cs index b8431bc..5c26934 100644 --- a/source/WaypointManager/WaypointFlightRenderer.cs +++ b/source/WaypointManager/WaypointFlightRenderer.cs @@ -403,19 +403,10 @@ protected string GetTimeToWaypoint(WaypointData wpd) double time = (wpd.distanceToActive / v.horizontalSrfSpeed); - // Earthtime - uint SecondsPerYear = 31536000; // = 365d - uint SecondsPerDay = 86400; // = 24h - uint SecondsPerHour = 3600; // = 60m - uint SecondsPerMinute = 60; // = 60s - - if (GameSettings.KERBIN_TIME == true) - { - SecondsPerYear = 9201600; // = 426d - SecondsPerDay = 21600; // = 6h - SecondsPerHour = 3600; // = 60m - SecondsPerMinute = 60; // = 60s - } + uint SecondsPerYear = (uint)KSPUtil.dateTimeFormatter.Year; + uint SecondsPerDay = (uint)KSPUtil.dateTimeFormatter.Day; + uint SecondsPerHour = (uint)KSPUtil.dateTimeFormatter.Hour; + uint SecondsPerMinute = (uint)KSPUtil.dateTimeFormatter.Minute; int years = (int)(time / SecondsPerYear); time -= years * SecondsPerYear;