Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
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;
        }