Pārlūkot izejas kodu

Show change in time when setting system clock

master
The6P4C pirms 7 gadiem
vecāks
revīzija
b4aab77d10
1 mainītis faili ar 7 papildinājumiem un 10 dzēšanām
  1. +7
    -10
      GPSDOTimeSync/FormMain.cs

+ 7
- 10
GPSDOTimeSync/FormMain.cs Parādīt failu

@@ -93,10 +93,10 @@ namespace GPSDOTimeSync {
return; 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(); TimeSpan maximumCorrection = new TimeSpan();
int maximumCorrectionValue = (int) numericUpDownMaximumCorrection.Value; int maximumCorrectionValue = (int) numericUpDownMaximumCorrection.Value;
string maximumCorrectionUnit = ""; string maximumCorrectionUnit = "";
@@ -125,13 +125,10 @@ namespace GPSDOTimeSync {
SystemTimeUtils.SetSystemTime(dateTime); SystemTimeUtils.SetSystemTime(dateTime);


Invoke(new Action(() => { 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; lastSystemTimeUpdate = Environment.TickCount;


Notiek ielāde…
Atcelt
Saglabāt