Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 1 addition & 33 deletions AlternateResourcePanel/SharedStuff/Drawing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,39 +267,7 @@ internal static void DrawTimeRemaining(Rect rectStart, ARPResource Res)

internal static String FormatTime(Double TimeInSecs)
{
String strReturn = "";

Double Second = TimeInSecs % 60;
Double Minute = Math.Truncate((TimeInSecs / 60) % 60);
Double HourRaw = TimeInSecs / 60 / 60;

Double Hour;
if (GameSettings.KERBIN_TIME)
Hour = Math.Truncate(HourRaw % 6);
else
Hour = Math.Truncate(HourRaw % 24);

Double Day;
if (GameSettings.KERBIN_TIME)
Day = Math.Truncate((HourRaw % (426 * 6)) / 6);
else
Day = Math.Truncate((HourRaw % (365 * 24)) / 24);

Double Year;
if (GameSettings.KERBIN_TIME)
Year = Math.Truncate((HourRaw / (426 * 6)));
else
Year = Math.Truncate((HourRaw / (365 * 24)));

if (Year > 0)
strReturn = String.Format("{0:0}y {1:0}d {2:00}:{3:00}:{4:00}", Year, Day, Hour, Minute, Second);
else if (Day > 0)
strReturn = String.Format("{0:0}d {1:00}:{2:00}:{3:00}", Day, Hour, Minute, Second);
else if (Hour > 0)
strReturn = String.Format("{1:0}:{2:00}:{3:00}", Day, Hour, Minute, Second);
else
strReturn = String.Format("{2:0}:{3:00.0}", Day, Hour, Minute, Second);
return strReturn;
return KSPUtil.dateTimeFormatter.PrintDateDeltaCompact(TimeInSecs, true, true, true);
}


Expand Down