Пример #1
0
        static void LogLastSynchronizationInfo()
        {
            if (m_lastSyncTime == null)
            {
                return;
            }

            // Start with time of last sync message (quoted to keep Excel from interpreting it as a double)
            string syncLine = string.Format("'{0}'", m_lastSyncTime.ToString());

            for (int clkInx = 0; clkInx < m_ptpMgr.Clocks.Count; clkInx++)
            {
                PtpClock        clock   = m_ptpMgr.Clocks[clkInx];
                PtpClockHistory history = null;

                for (int histInx = 0; histInx < clock.ClockHistory.Count; histInx++)
                {
                    if (clock.ClockHistory[histInx].TimeStamp.Seconds == m_lastSyncTime.Seconds &&
                        clock.ClockHistory[histInx].TimeStamp.NanoSeconds == m_lastSyncTime.NanoSeconds)
                    {
                        history = clock.ClockHistory[histInx];
                        break;
                    }
                }
                if (history != null)
                {
                    syncLine += string.Format(", {0}, {1}",
                                              history.CurrentData.OffsetFromMaster,
                                              history.CurrentData.MeanPathDelay);
                }
                else
                {
                    syncLine += ",, ";
                }
            }

            Console.WriteLine(syncLine);
            m_logFile.WriteLine(syncLine);
        }