Beispiel #1
0
        private void Synchronize()
        {
            try {
                NistClock nistClock = new NistClock();
                TimeSpan  error     = nistClock.SynchronizeLocalClock();
                prevAdjustment = error.TotalSeconds;
                syncErrorText  = string.Empty;  // clear any prior error text
                prevSyncTime   = DateTime.Now;
            } catch (Exception) {
                syncErrorText = "There was an error trying to synchronize with the NIST timeserver.\nAre you connected to the Internet?";
            }

            immediateSyncRequsted = false;
            SetControlPropertyValue(SyncButton, "Enabled", true);
        }
Beispiel #2
0
        /// <summary>
        /// Sync the Clock to Internet Time
        /// </summary>
        /// <returns>True if Successfull False if Failed</returns>
        static public bool SynchronizeTime()
        {
            bool synced = false;

            try
            {
                NistClock c = new NistClock();
                c.SynchronizeLocalClock();
                synced = true;
            }
            catch
            {
            }

            return(synced);
        }
        /// <summary>
        /// Sync the Clock to Internet Time
        /// </summary>
        /// <returns>True if Successfull False if Failed</returns>
        static public bool SynchronizeTime()
        {
            bool synced = false;

            try
            {
                NistClock c = new NistClock();
                c.SynchronizeLocalClock();
                synced = true;
            }
            catch
            {

            }

            return synced;
        }