Beispiel #1
0
        // Converts the object to string
        public override string ToString()
        {
            string str;

            str = "Leap Indicator: ";
            switch (LeapIndicator)
            {
            case _LeapIndicator.NoWarning:
                str += "No warning";
                break;

            case _LeapIndicator.LastMinute61:
                str += "Last minute has 61 seconds";
                break;

            case _LeapIndicator.LastMinute59:
                str += "Last minute has 59 seconds";
                break;

            case _LeapIndicator.Alarm:
                str += "Alarm Condition (clock not synchronized)";
                break;
            }
            str += "\r\nVersion number: " + VersionNumber.ToString() + "\r\n";
            str += "Mode: ";
            switch (Mode)
            {
            case _Mode.Unknown:
                str += "Unknown";
                break;

            case _Mode.SymmetricActive:
                str += "Symmetric Active";
                break;

            case _Mode.SymmetricPassive:
                str += "Symmetric Pasive";
                break;

            case _Mode.Client:
                str += "Client";
                break;

            case _Mode.Server:
                str += "Server";
                break;

            case _Mode.Broadcast:
                str += "Broadcast";
                break;
            }
            str += "\r\nStratum: ";
            switch (Stratum)
            {
            case _Stratum.Unspecified:
            case _Stratum.Reserved:
                str += "Unspecified";
                break;

            case _Stratum.PrimaryReference:
                str += "Primary Reference";
                break;

            case _Stratum.SecondaryReference:
                str += "Secondary Reference";
                break;
            }
            str += "\r\nLocal time: " + TransmitTimestamp.ToString();
            str += "\r\nPrecision: " + Precision.ToString() + " ms";
            str += "\r\nPoll Interval: " + PollInterval.ToString() + " s";
            str += "\r\nReference ID: " + ReferenceID.ToString();
            str += "\r\nRoot Dispersion: " + RootDispersion.ToString() + " ms";
            str += "\r\nRound Trip Delay: " + RoundTripDelay.ToString() + " ms";
            str += "\r\nLocal Clock Offset: " + LocalClockOffset.ToString() + " ms";
            str += "\r\n";

            return(str);
        }
Beispiel #2
0
        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            string str;

            str = "Leap Indicator: ";
            switch (LeapIndicator)
            {
            case LeapIndicator.NoWarning:
                str += "No warning";
                break;

            case LeapIndicator.LastMinute61:
                str += "Last minute has 61 seconds";
                break;

            case LeapIndicator.LastMinute59:
                str += "Last minute has 59 seconds";
                break;

            case LeapIndicator.Alarm:
                str += "Alarm Condition (clock not synchronized)";
                break;
            }
            str += "\r\nVersion number: " + VersionNumber.ToString() + "\r\n";
            str += "Mode: ";
            switch (Mode)
            {
            case NtpMode.Unknown:
                str += "Unknown";
                break;

            case NtpMode.SymmetricActive:
                str += "Symmetric Active";
                break;

            case NtpMode.SymmetricPassive:
                str += "Symmetric Pasive";
                break;

            case NtpMode.Client:
                str += "Client";
                break;

            case NtpMode.Server:
                str += "Server";
                break;

            case NtpMode.Broadcast:
                str += "Broadcast";
                break;
            }
            str += "\r\nStratum: ";
            switch (Stratum)
            {
            case NtpStratum.Unspecified:
            case NtpStratum.Reserved:
                str += "Unspecified";
                break;

            case NtpStratum.PrimaryReference:
                str += "Primary Reference";
                break;

            case NtpStratum.SecondaryReference:
                str += "Secondary Reference";
                break;
            }
            str += "\r\nOriginate (Send request): " + OriginateTimestamp.ToString("dd/MM/yyyy HH:mm:ss.fff");
            str += "\r\nRecieve (Server recieved): " + ReceiveTimestamp.ToString("dd/MM/yyyy HH:mm:ss.fff");
            str += "\r\nTransmit (Server reply): " + TransmitTimestamp.ToString("dd/MM/yyyy HH:mm:ss.fff");
            str += "\r\nReception (Request recieved): " + ReceptionTimestamp.ToString("dd/MM/yyyy HH:mm:ss.fff");
            str += "\r\nServer transmit time (Local zone): " + TransmitTimestamp.ToString("dd/MM/yyyy HH:mm:ss.fff");
            str += "\r\nPrecision: " + Precision.ToString() + " ms";
            str += "\r\nPoll Interval: " + PollInterval.ToString() + " s";
            str += "\r\nReference ID: " + ReferenceID.ToString();
            str += "\r\nRoot Dispersion: " + RootDispersion.ToString() + " ms";
            str += "\r\nRound Trip Delay: " + RoundTripDelay.TotalMilliseconds.ToString() + " ms";
            str += "\r\nLocal Clock Offset: " + LocalClockOffset.TotalMilliseconds.ToString() + " ms";
            str += "\r\n";

            return(str);
        }