private void TimeService_SystemTimeChanged(object sender, SystemTimeChangedEventArgs e) { lock (this) { hasTimeFixed = true; } Debug.Print("Time Fixed"); }
private static void TimeService_SystemTimeChanged(object sender, SystemTimeChangedEventArgs e) { Trace("Network time received."); if (!timeSynchronized) { timeSynchronized = true; DoMqttStuff(); } }
/// <summary> /// TimeService System Time Changed Handler: signals through event "correct_time_event" the time correctness /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void TimeService_SystemTimeChanged(object sender, SystemTimeChangedEventArgs e) { lock (time_lock) { time_offset = DateTime.UtcNow - last_wrong_time; correct_time = true; } /* Signal correct time */ correct_time_event.Set(); #if (DEBUG) Debug.Print("DateTime = " + DateTime.Now.ToString()); #endif }
void TimeService_SystemTimeChanged(object sender, SystemTimeChangedEventArgs e) { // creating instance of manager TimeManager mgr = TimeManager.TimeMgr; // Updating current time mgr.UpdatedTime = DateTime.Now.ToString("HH:mm:ss"); Program.currentTime = DateTime.Now.ToString("HH:mm:ss"); if (!mgr.IsTimeSync) { mgr.IsTimeSync = true; } }
/// <summary> /// TimeService SystemTimeChanged Event, when the system time changes, we need to set offset depending on daylight savings /// </summary> /// <param name="sender">Sender object</param> /// <param name="e">SystemTimeChangedEvent Arguments</param> private void TimeService_SystemTimeChanged(object sender, SystemTimeChangedEventArgs e) { //Daylight savings are the last sunday of march and october DateTime march = new DateTime(DateTime.Now.Year, 3, 1); DateTime october = new DateTime(DateTime.Now.Year, 10, 1); //Get last sunday in both months DateTime daylightstart = LastDayInMonth(march, DayOfWeek.Sunday); DateTime daylightstop = LastDayInMonth(october, DayOfWeek.Sunday); //If we are within thoose dates, add daylight saving time if (daylightstart.Ticks < DateTime.Now.Ticks && daylightstop.Ticks > DateTime.Now.Ticks) { TimeService.SetTimeZoneOffset(TimeZoneMinutes + DaylightSavingTime); } else { TimeService.SetTimeZoneOffset(TimeZoneMinutes); } }
private void OnSystemTimeChanged(Object sender, SystemTimeChangedEventArgs e) // Called on successful NTP Synchronization { var now = DateTime.Now; // Used to manipulate dates and time #region Check if we are in summer time and thus daylight savings apply // Check if we are in Daylight savings. The following algorithm works pour Europe and associated countries // In Europe, daylight savings (+60 min) starts the last Sunday of march and ends the last sunday of october var aprilFirst = new DateTime(now.Year, 4, 1); var novemberFirst = new DateTime(now.Year, 11, 1); var sundayshift = new[] { 0, -1, -2, -3, -4, -5, -6 }; var marchLastSunday = aprilFirst.DayOfYear + sundayshift[(int)aprilFirst.DayOfWeek]; var octoberLastSunday = novemberFirst.DayOfYear + sundayshift[(int)novemberFirst.DayOfWeek]; if ((now.DayOfYear >= marchLastSunday) && (now.DayOfYear < octoberLastSunday)) { _daylightSavingsShift = 60; } else { _daylightSavingsShift = 0; } TimeService.SetTimeZoneOffset(LocalTimeZone + _daylightSavingsShift); #endregion // Display the synchronized date on the Debug Console now = DateTime.Now; var date = now.ToString("dd/MM/yyyy"); var here = now.ToString("HH:mm:ss"); Debug.Print(date + " // " + here); }
void TimeService_SystemTimeChanged(object sender, SystemTimeChangedEventArgs e) { Logger.TraceLog("Time: System Time Changed: " + e.EventTime); }
private void TimeService_SystemTimeChanged(object sender, SystemTimeChangedEventArgs e) { Program.setInternet(true); Debug.Print("Time is changed.\n"); }
private static void TimeService_SystemTimeChanged(object sender, SystemTimeChangedEventArgs e) { TimeChanged.Set( ); }
private static void TimeService_SystemTimeChanged(object sender, SystemTimeChangedEventArgs e) { Debug.WriteLine("SystemTime has changed. Actual local Time is " + DateTime.Now); Debug.WriteLine("Actual utc Time is " + DateTime.UtcNow); }
private static void TimeService_SystemTimeChecked(object sender, SystemTimeChangedEventArgs e) { Debug.WriteLine("SystemTime was checked! " + DateTime.Now); }
static void TimeService_SystemTimeChanged(object sender, SystemTimeChangedEventArgs e) { Debug.Print("Ntp sync OK!"); }
void TimeService_SystemTimeChanged(object sender, SystemTimeChangedEventArgs evt) { Debug.Print("System Time Changed."); }
private static void onSystemTimeChanged(object sender, SystemTimeChangedEventArgs e) { Debug.Print("System time changed by Time Service: " + DateTime.Now.ToString()); isTimeSet = true; }
private static void TimeService_SystemTimeChanged(object sender, SystemTimeChangedEventArgs e) { Debug.Print("Time Synchronized -> " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")); Display.UpdateTimeStatus(true); }