diff --git a/ATxCommon/TimeUtils.cs b/ATxCommon/TimeUtils.cs index a499a16eff020e2ef42b7e225f6ae2cdc6e1aead..c9f9aa01c597e25ca26924ffd4dce84b9f1a1195 100644 --- a/ATxCommon/TimeUtils.cs +++ b/ATxCommon/TimeUtils.cs @@ -17,8 +17,8 @@ namespace ATxCommon /// </summary> /// <param name="refDate">The reference DateTime to check.</param> /// <returns>The number of minutes between the reference date and now.</returns> - public static int MinutesSince(DateTime refDate) { - return (int)(DateTime.Now - refDate).TotalMinutes; + public static long MinutesSince(DateTime refDate) { + return (long)(DateTime.Now - refDate).TotalMinutes; } /// <summary> @@ -26,8 +26,8 @@ namespace ATxCommon /// </summary> /// <param name="refDate">The reference DateTime to check.</param> /// <returns>The number of seconds between the reference date and now.</returns> - public static int SecondsSince(DateTime refDate) { - return (int)(DateTime.Now - refDate).TotalSeconds; + public static long SecondsSince(DateTime refDate) { + return (long)(DateTime.Now - refDate).TotalSeconds; } /// <summary> @@ -35,7 +35,7 @@ namespace ATxCommon /// </summary> /// <param name="delta">The time span in seconds.</param> /// <returns>A string describing the duration, e.g. "2 hours 34 minutes".</returns> - public static string SecondsToHuman(int delta) { + public static string SecondsToHuman(long delta) { const int second = 1; const int minute = second * 60; const int hour = minute * 60; @@ -70,7 +70,7 @@ namespace ATxCommon /// </summary> /// <param name="delta">The time span in minutes.</param> /// <returns>A string describing the duration, e.g. "2 hours 34 minutes".</returns> - public static string MinutesToHuman(int delta) { + public static string MinutesToHuman(long delta) { return SecondsToHuman(delta * 60); } @@ -79,7 +79,7 @@ namespace ATxCommon /// </summary> /// <param name="delta">The time span in days.</param> /// <returns>A string describing the duration, e.g. "12 days" or "3 weeks".</returns> - public static string DaysToHuman(int delta) { + public static string DaysToHuman(long delta) { return MinutesToHuman(delta * 60 * 24); } } diff --git a/ATxService/AutoTx.cs b/ATxService/AutoTx.cs index b8dcbb0d00f302a5f5c8564d0b319682b77e8d60..5aebbb0749921f44ca93a129a749a51ef9547390 100644 --- a/ATxService/AutoTx.cs +++ b/ATxService/AutoTx.cs @@ -424,7 +424,7 @@ namespace ATxService Log.Error("Unhandled exception in OnTimedEvent(): {0}\n\n" + "Trying exponential backoff, setting timer interval to {1} ms ({3}).\n\n" + "StackTrace: {2}", ex.Message, _mainTimer.Interval, ex.StackTrace, - TimeUtils.SecondsToHuman((int)_mainTimer.Interval / 1000)); + TimeUtils.SecondsToHuman((long)_mainTimer.Interval / 1000)); } finally { // make sure to enable the timer again: