void SynchroTimeTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            CTimeSynchroClass ts = new CTimeSynchroClass {
                DtCurrentTime = DateTime.Now
            };

            SendDataToClients(ts, enmTradingEvent.SynchroniseTime, "");
        }
Beispiel #2
0
        private void ProcessSynchroniseTime(byte[] arrMsgBody)
        {
            Log("[TimeSynchro]");

            bool needSynchro = false;

            lock (_kernelTerminal.TerminalConfig)
                needSynchro = _kernelTerminal.TerminalConfig.NeedTimeSynchro;


            //TODO send moscow time flag or not (or Timezone) on datamessage


            CTimeSynchroClass ts = CUtilProto.DeserializeProto <CTimeSynchroClass>(arrMsgBody);

            //removed 2018-03-28 to remove message "Time syncro dtMS=" from error log

            /*
             * if (needSynchro)
             * {
             *
             *  int dtMS = (int)(DateTime.Now - ts.DtCurrentTime).TotalMilliseconds;
             *
             *  int param = 20;
             *  if (Math.Abs(dtMS) > param)
             *  {
             *      CTimeChanger tch = new CTimeChanger(-dtMS);
             *      Error("Time syncro dtMS=" + dtMS);
             *  }
             * }
             */

            DateTime dtMsc = CUtilTime.LocalToMsc(ts.DtCurrentTime);

            try
            {
                _terminalViewModel.StockClock = dtMsc.ToString("HH:mm:ss");
            }
            catch (Exception e)
            {
                Thread.Sleep(0);
            }
        }