From b4aab77d1002c7be1d3c09d7a00540fedb4d99fa Mon Sep 17 00:00:00 2001 From: The6P4C Date: Sat, 30 Sep 2017 09:35:46 +1000 Subject: [PATCH] Show change in time when setting system clock --- GPSDOTimeSync/FormMain.cs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/GPSDOTimeSync/FormMain.cs b/GPSDOTimeSync/FormMain.cs index bf36efa..a8e2e82 100644 --- a/GPSDOTimeSync/FormMain.cs +++ b/GPSDOTimeSync/FormMain.cs @@ -93,10 +93,10 @@ namespace GPSDOTimeSync { return; } - if (checkBoxMaximumCorrectionEnabled.Checked) { - // Positive error means system clock is ahead, negative error means system clock is behind - TimeSpan error = SystemTimeUtils.GetSystemTime().Subtract(dateTime).Duration(); + // Positive error means system clock is ahead, negative error means system clock is behind + TimeSpan error = SystemTimeUtils.GetSystemTime().Subtract(dateTime).Duration(); + if (checkBoxMaximumCorrectionEnabled.Checked) { TimeSpan maximumCorrection = new TimeSpan(); int maximumCorrectionValue = (int) numericUpDownMaximumCorrection.Value; string maximumCorrectionUnit = ""; @@ -125,13 +125,10 @@ namespace GPSDOTimeSync { SystemTimeUtils.SetSystemTime(dateTime); Invoke(new Action(() => { - AddMessageToLog( - string.Format( - "System time set to {0}.", - dateTime.ToString("HH:mm:ss dd\\/MM\\/yyyy") - ), - LogLevel.Info - ); + AddMessageToLog(string.Format( + "System time set to {0} ({1}).", + dateTime.ToString("HH:mm:ss dd\\/MM\\/yyyy"), error.ToString() + ), LogLevel.Info); })); lastSystemTimeUpdate = Environment.TickCount;