Tracing NTP time service method and device and storage medium

By adding a traceability information extension field to the NTP response message, the problem that existing NTP or NTS protocols cannot provide time source reliability is solved. It enables dynamic marking and transmission of clock source level and link information without changing the client structure, improving the reliability and accuracy of time synchronization and supporting a traceability mechanism for multi-level link forwarding.

CN121098435APending Publication Date: 2025-12-09SICHUAN TAIFU GROUND BEIDOU TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511137082.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-14
Publication Date
2025-12-09

AI Technical Summary

Technical Problem

Existing NTP or NTS protocols cannot provide information about the reliability of the time source, making it impossible for clients to determine the accuracy of the clock source and the link structure. This poses a risk of a trusted link combined with an untrusted time source. Furthermore, existing solutions such as IEEE 1588 PTP networks and direct fiber optic synchronization links are complex and costly to deploy, and lack lightweight, standards-compatible traceable time synchronization mechanisms across networks, devices, and multi-hop paths.

Method used

Add a source information extension field to the NTP response message, which includes clock source level information, time deviation estimation information, and link node information. Append the node type and number with each forward. The client parses this information to determine the reliability and expected accuracy of the time.

Benefits of technology

It enables dynamic marking and transmission of clock source level and link information without changing the client and protocol stack structure, improving the reliability and accuracy of time synchronization, supporting a multi-level link forwarding traceability mechanism, and possessing good deployment feasibility and compatibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121098435A_ABST
    Figure CN121098435A_ABST
Patent Text Reader

Abstract

The invention discloses a traceability NTP time service method and device and a storage medium. The method comprises the following steps: generating an NTP response message conforming to an NTPv4 or NTS standard structure, wherein the NTP response message comprises a standard NTP header field; adding a traceability information extension field in the NTP response message, wherein the traceability information extension field at least comprises clock source level information, time deviation estimation information with a clock source and link node information for representing a time path structure; forwarding the NTP response message, and adding corresponding node type and node quantity information in the traceability information extension field during each forwarding; and after the NTP response message is received, analyzing the traceability information extension field, and determining the credibility and the expected precision of the received time based on the clock source level information, the time deviation estimation information with the clock source and the link node information.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of network, in particular to a traceable NTP time service method and device and storage medium. BACKGROUND

[0002] Network time synchronization is an indispensable technical means in modern network infrastructure, and is widely used in finance, communication, power, transportation and other fields with strict requirements for time synchronization accuracy and reliability. As one of the most popular network time synchronization protocols, NTP (Network Time Protocol) has developed to NTPv4 version since 1985, and its standard definition is in the RFC 5905 document. In addition, the NTP over TLS (NTS) protocol as a security enhancement scheme for the traditional NTP protocol has also been gradually applied to the time service requirements in public network scenarios.

[0003] The existing NTP or NTS protocol usually adopts encryption mechanisms (such as MD5, HMAC-SHA-256, NTS protocol link encryption, etc.) to ensure the link security of the message transmission process between the NTP server and the client, and prevent the time service message from being tampered or forged. However, the above mechanism can only guarantee the transmission security in the time service path, and cannot provide related information about the "trustworthiness of the time service source". That is, when the client obtains time from a certain NTP server, the client cannot judge whether the clock source behind the server is high-precision, whether it is out of lock or whether there is a problem of too deep link level, thereby easily causing the potential risk of "trusted link + untrusted time source".

[0004] In order to improve the reliability of system time synchronization, a private link architecture (such as IEEE 1588 PTP network, optical direct synchronization link, etc.) in a master-slave structure is adopted in some scenarios, which ensures the reliability of the time service path through physical isolation. However, such scheme is complex to deploy, has high cost, and depends on the fixed topology structure of end-to-end, and lacks a "lightweight, standard compatible" traceable time synchronization mechanism suitable for cross-network, cross-device and multi-hop path.

[0005] Therefore, how to provide a "traceable time service mechanism" that can be deployed without changing the client and protocol stack structure, and can dynamically mark and deliver the clock source level and link information, based on the existing NTPv4 / NTS standards, has become a key technical problem to be solved in the development of current network time service technology. SUMMARY

[0006] In order to solve the above technical problems, the present application provides a traceable NTP time service method, device and storage medium.

[0007] The technical solutions provided in the present application are described as follows: The first aspect of the present application provides a traceable NTP time service method, comprising: generating an NTP response message conforming to the NTPv4 or NTS standard structure, wherein the NTP response message contains a standard NTP header field; adding a traceable information extension field in the NTP response message, wherein the traceable information extension field at least includes clock source level information, time deviation estimation information from the clock source, and link node information for representing a time path structure; forwarding the NTP response message, and each time forwarding, appending corresponding node type and node quantity information in the traceable information extension field; when receiving the NTP response message, parsing the traceable information extension field, and determining the credibility and expected accuracy of the received time based on the clock source level information, the time deviation estimation information from the clock source, and the link node information.

[0008] Optionally, the clock source level information is a Clock Class field, and the corresponding value is set by the most upstream clock source in the time link and remains unchanged in the entire time path.

[0009] Optionally, the value of the Clock Class field includes one of the following levels: atomic clock group is set to 1; ePRTC or PRTC normally tracking satellites is set to 6; ePRTC or PRTC losing satellites and entering a holdover state is set to 7; ePRTC or PRTC in a free running state is set to 52.

[0010] Optionally, the time deviation estimation information is an Accuracy field, which is used to represent the cumulative time error between the current node and the clock source, and the corresponding value is accumulated and updated according to the link type each time the NTP response message is forwarded.

[0011] Optionally, the error accumulation update strategy of the Accuracy field includes: 2 picoseconds are added each time a node passes through a fiber time service link; 5 nanoseconds to 10 microseconds are added each time a node passes through a PTP time service link; 10 microseconds to 50 milliseconds are added each time a node passes through an NTP time service link.

[0012] Optionally, the link node information comprises a plurality of node types and corresponding node numbers, each node type being used to identify a link category experienced by the NTP response message in a transmission path, and the node types comprise: an optical fiber timing link, a precision time protocol (PTP) link, and a network time protocol (NTP) link.

[0013] Optionally, in each NTP response message forwarding process, the following steps are performed: parsing a trace information extension field in the received NTP response message; calculating a time deviation increment value based on a current link type and performance parameter, and adding the time deviation increment value to time deviation estimation information in the trace information extension field; judging whether the current link type has been recorded in the trace information extension field; if not, appending a new node type and an initial node number value; if yes, updating the node number of the type; re-encapsulating the updated NTP response message and forwarding the NTP response message to a next node.

[0014] Optionally, after receiving the NTP response message, the trace information extension field is parsed, and the reliability and expected accuracy of the received time are determined based on the clock source level information, the time deviation estimation information of the clock source, and the link node information, comprising: extracting the clock source level field, the time deviation estimation information, and the link node information in the trace information extension field; comparing the clock source level field and the time deviation estimation information with a locally set trusted clock source level threshold and a maximum allowed error threshold, respectively; if a preset reliability judgment condition is met, performing time synchronization; if the preset reliability judgment condition is not met, refusing synchronization.

[0015] Optionally, the preset reliability judgment condition at least comprises one of the following: condition 1: the clock source level is higher than a preset trusted clock source level threshold; condition 2: the time deviation estimation information is lower than a preset maximum allowed error threshold; condition 3: the number of link nodes recorded in the NTP response message is lower than a preset hop threshold.

[0016] Optionally, further comprising: analyzing the value of the Clock Class field, and if the Clock Class is equal to 1 or 6, marking it as a high-trust source; If the Clock Class is 7 or 52, mark as low trust or lockout source; If the Clock Class is missing or illegal, mark as unavailable.

[0017] The second aspect of the present application provides a traceable NTP time service device, the device comprising: a packet generation unit configured to generate an NTP response packet conforming to an NTPv4 or NTS standard structure, the NTP response packet comprising a standard NTP header field; a field extension unit configured to add a trace information extension field in the NTP response packet, the trace information extension field comprising at least clock source level information, time deviation estimation information from the clock source, and link node information for representing a time path structure; a packet forwarding unit configured to forward the NTP response packet, and each time the packet is forwarded, corresponding node type and node quantity information is added in the trace information extension field; a packet analysis unit configured to, when receiving the NTP response packet, analyze the trace information extension field, and determine the trustworthiness and expected accuracy of the received time based on the clock source level information, the time deviation estimation information from the clock source, and the link node information.

[0018] The third aspect of the present application provides a traceable NTP time service device, the device comprising: a processor, a memory, an input / output unit, and a bus; the processor is connected to the memory, the input / output unit, and the bus; the memory stores a program, and the processor invokes the program to execute the method of the first aspect and any optional method of the first aspect.

[0019] The fourth aspect of the present application provides a computer readable storage medium, the computer readable storage medium stores a program, and the program executes the method of the first aspect and any optional method of the first aspect when executed on a computer.

[0020] From the above technical solutions, the present application has the following beneficial effects: The traceable NTP time service method provided by the present application is based on the standard NTPv4 or NTS protocol structure, and does not destroy the original packet compatibility. By extending the trace information extension field carrying the clock source level information, the time deviation estimation information, and the link node structure information in the NTP response packet, the full-link traceability of the network time transmission path is realized. The method has the following beneficial technical effects: 1. Compared with the technical defects of the existing NTP time service method which only guarantees the encryption security of the transmission link but cannot identify the quality of the time source, the application can make the client judge the source level of the received time and the rationality of the link structure based on the preset rules by attaching the identifiable clock source level field (such as Clock Class) and the link structure information in the message, thereby fundamentally improving the reliability of time synchronization.

[0021] 2. The variable expansion structure of the node type and node number field is adopted to support the automatic addition of trace information of the time service message in the multi-level link forwarding process, so that the complete time service path structure can be dynamically constructed without external database or separate management system, and the trace mechanism of "transmission and recording at the same time" is realized.

[0022] 3. The trace information extension field structure design is flexible, compatible with the existing NTP client and NTS protocol implementation, which can be embedded in the NTP message reserved field defined in RFC5905 or attached after the NTS extension field, and has good deployment feasibility and backward compatibility.

[0023] 4. The client can perform reliability judgment processing based on the trace field after receiving the message, such as determining whether to adopt the time or issuing an alarm according to the time source level and the cumulative error, thereby improving the fine management ability and robustness of the system time synchronization strategy. BRIEF DESCRIPTION OF DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the present application, the following will briefly introduce the drawings needed to be used in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.

[0025] Figure 1 An embodiment flowchart of a trace NTP time service method provided in the present application; Figure 2 An embodiment flowchart of step S103 in a trace NTP time service method provided in the present application; Figure 3 An embodiment flowchart of step S104 in a trace NTP time service method provided in the present application; Figure 4 An embodiment structure diagram of a trace NTP time service device provided in the present application; Figure 5 An embodiment structure diagram of another trace NTP time service device provided in the present application. DETAILED DESCRIPTION

[0026] Please refer toFigure 1 The application first provides an embodiment of a traceable NTP time service method, which comprises the following steps: S101, generating an NTP response message conforming to the NTPv4 or NTS standard structure, wherein the NTP response message contains a standard NTP header field; In this step, the time service server generates a standard NTP response message according to the NTPv4 or NTS protocol specification. The NTP response message contains a standard NTP header field with a fixed length, and the header field includes but is not limited to leap indicator (LI), version number (VN), mode, stratum, poll, precision, root delay, root dispersion, reference ID, reference timestamp, origin timestamp, receive timestamp, transmit timestamp, etc.

[0027] The response message can be transmitted in plaintext, or can use MD5, SHA-1, HMAC series encryption algorithms or NTS protocol security transmission mode to ensure the security and integrity of the message in network transmission.

[0028] In order to realize the credibility evaluation and traceability function of the time link, the application extends the fields of the NTP response message on the basis of conforming to the NTPv4 or NTS standard structure. Table 1 shows the NTP response message field structure and explanation used in the application.

[0029] Among them, the “Traceability Information” field is a new field added by the application, which uses a self-defined extended format to carry content including clock source level, time deviation estimation information, link node information, etc. The specific field structure is shown in Table 1. The field type can be set to 0x0101, and it follows the NTP protocol extension field design specification, and has good backward compatibility.

[0030] Table 1. NTP response message field structure and explanation

[0031] S102, adding a trace information extension field in the NTP response message, the trace information extension field including at least clock source level information, time deviation estimation information of the clock source, and link node information for representing a time path structure; In this step, the time service server appends a "trace information extension field" in the reserved extension field position of the NTP response message or after the NTS extension field. The extension field includes at least the following contents: Clock Class: representing the level of the current time source, such as an atomic clock group, an enhanced primary reference clock (ePRTC), a free-running clock, etc.

[0032] In an embodiment of the trace NTP time service method of the present application, the clock source level information in the trace information extension field is represented by a Clock Class field. Specifically, the value of the Clock Class field is set by the most upstream clock source in the time link and remains unchanged in the entire time path, ensuring that all nodes in the link uniformly identify the clock source level.

[0033] Preferably, the value of the Clock Class field can take one of the following levels according to the actual clock source type: When the clock source is an atomic clock group, the Clock Class field is set to 1, which represents a high-precision atomic clock group composed of cesium clocks and hydrogen clocks, commonly used in authoritative time sources such as national time service centers; When the clock source is an enhanced primary reference clock or a primary reference clock (ePRTC or PRTC) that normally tracks satellites, the Clock Class field is set to 6, indicating that the clock source is in a normal state and has high time precision; When the clock source is an ePRTC or PRTC in a holdover state after losing satellite signals, the Clock Class field is set to 7, indicating that the clock source is in a holdover state and the time precision may decrease; When the clock source is an ePRTC or PRTC in a free-running state, the Clock Class field is set to 52, indicating that the clock source does not track satellites or has been in a holdover state for too long, and cannot maintain the set time precision index.

[0034] Through the above Clock Class level definition, the system can clearly determine the priority of different time sources, thereby providing a basis for the credibility evaluation of the trace information and improving the stability and reliability of the overall time service system.

[0035] Time deviation estimation information (Accuracy) for indicating the estimated time error of the current node clock relative to the link starting clock source, which can be in the order of picoseconds (ps) and reflects the accuracy and reliability of the clock.

[0036] In an embodiment of the traceable NTP time service method, the time deviation estimation information in the trace information extension field is represented by an Accuracy field, which is used to indicate the cumulative time error between the current time service node and the most upstream clock source of the link.

[0037] Specifically, the value of the Accuracy field is updated by accumulation according to the type of the link passed through during each NTP response message forwarding process, thereby reflecting the continuous accumulation of errors in the link transmission process. The specific accumulation strategy includes: When the time service link type is a fiber time service link, the error value of the Accuracy field is accumulated by about 2 picoseconds (ps) for each link node passed through, reflecting the ultra-high precision transmission characteristics of the fiber link; When the time service link type is a PTP time service link, the error value of the Accuracy field is accumulated by about 5 nanoseconds (ns) to 10 microseconds (us) for each link node passed through, and the specific accumulation value depends on the difference in link node performance; When the time service link type is an NTP time service link, the error value of the Accuracy field is accumulated by about 10 microseconds (us) to 50 milliseconds (ms) for each link node passed through, which reflects the larger time error accumulation of the NTP link compared to other links.

[0038] Through this error accumulation and update mechanism, the time service system can reflect the cumulative time deviation of the current time source relative to the original clock source in real time, provide accurate time precision evaluation basis for the client, and enhance the time traceability capability and time service precision guarantee of the system.

[0039] Link node information: representing the type of link (such as fiber time service link, PTP link, NTP link, etc.) and the corresponding number of nodes passed through from the original clock source to the current time service node, used to describe the path structure of time transmission.

[0040] The trace information extension field adopts a structured coding format to ensure variable length and support multi-level node information superposition.

[0041] In an embodiment of the traceable NTP time service method, the link node information in the trace information extension field includes multiple node types and corresponding node numbers, which are used to describe in detail the different link categories and their numbers experienced by the NTP response message in the transmission path.

[0042] Specifically, the link node types include, but are not limited to, the following categories: Fiber timing link: represents a timing link transmitted through an optical fiber, this link type usually provides extremely high time synchronization accuracy due to its high bandwidth and low delay characteristics; Precision Time Protocol (PTP) link: represents a link for timing through the PTP protocol, which is usually used in local area network or industrial network environment, and supports high-precision time synchronization; Network Time Protocol (NTP) link: represents a link for timing through the NTP protocol, which is suitable for wide area network environment, and has relatively lower accuracy than the former two.

[0043] In each forwarding process of the NTP response message, the forwarding node correspondingly increases the number of nodes of the type according to the type of the link where the forwarding node is located, so as to accumulate the complete link structure information.

[0044] Through the record of the link node information, the client can accurately understand the transmission path and environment of the time signal, further evaluate the credibility of the time and the accuracy of the synchronization, and provide reliable support for the stable operation of the network timing system.

[0045] In the present application, in order not to destroy the existing NTP protocol structure and compatibility, the traceability mechanism of the time path is realized on the basis of the expansion of the standard NTP message structure. As shown in Table 2, the expanded NTP message can contain three types of information segments: NTP Header: standard NTP message header field, length fixed at 48 bytes; NTS Information: security field conforming to the Network Time Security (NTS) protocol, field type is 0x0004 to 0x0006, length is variable; Traceability Information: newly added time traceability extension field of the present application, field type is set to 0x0101, length is dynamically adjusted according to the traceability information content.

[0046] Table 2. NTP response message format containing NTS and traceability information

[0047] In order to realize the time traceability function in the NTP message, the present embodiment adds a set of extension fields-Traceability Information field on the basis of conforming to the NTPv4 / NTS specification, which is used to carry the traceability information in the time path, including clock source level, accuracy estimation, link structure and other contents.

[0048] Table 3 lists the specific structure of the Traceability Information field. Among them: The "Clock Class" field is used to identify the level of the traceable top-level clock source; The "Accuracy" field is used to estimate the cumulative deviation of the current time relative to the top-level clock source, in picoseconds; The "Clock Name" is used to identify the unique name or identification code of the top-level clock source; The "Node type" and "Node count" fields record the link types and corresponding numbers experienced during time transmission in the form of key-value pairs, supporting hop-by-hop recording of link structure, facilitating traceability and credibility judgment.

[0049] The extension field is inserted in the NTP packet in the form of a standard extension field, following the structure design specifications of existing protocols, and has good backward compatibility and scalability.

[0050] Table 3. Time traceability information (Traceability Information) field structure description

[0051] S103, forwarding the NTP response packet, and each time forwarding, appending the corresponding node type and node number information in the traceability information extension field; In this step, when the NTP response packet is forwarded through the intermediate nodes in the time synchronization link, each forwarding node parses the traceability information extension field in the packet, and according to the link type and node situation of itself, appends its own node type identifier and node number in the traceability information.

[0052] Specifically, the node first reads the link node information in the current traceability information, and according to the link type it belongs to (for example, 0x01 represents optical fiber link, 0x02 represents PTP link, 0x03 represents NTP link, etc.), the corresponding node number is accumulated, or the link type and node number field is newly added, to reflect the multi-level structure on the current time path. Through this mechanism, the traceability information is accumulated hop by hop in the network, realizing the complete tracking of the time synchronization path.

[0053] A specific embodiment of step S103 is provided below, referring to Figure 2 In this embodiment, when the intermediate node in the time synchronization link receives the NTP response packet with the traceability information extension field, the following processing steps are performed: S1031, parsing the traceability information extension field in the received NTP response packet; The node first parses the received NTP response message, extracts the traceability information extension field therein, and obtains the clock level, cumulative time deviation, and link node information of the current link.

[0054] S1032, based on the current link type and performance parameter, a time deviation increment value is calculated and added to the time deviation estimation information in the traceability information extension field; According to the link type in which the node is located and the performance parameter of the link, the increment value of the node to the time deviation is calculated. The increment value is determined according to a preset error accumulation strategy, for example, 2 picoseconds for an optical fiber link node, 5 nanoseconds to 50 microseconds for a PTP link node, and 10 microseconds to 1 millisecond for an NTP link node. The increment value is added to the time deviation estimation (Accuracy) information in the traceability information extension field to reflect the cumulative growth of the time error.

[0055] S1033, judging whether the current link type has been recorded in the traceability information extension field; The node judges whether there is a record of the link type in which the node is located in the traceability information extension field.

[0056] S1034, if not recorded, a new node type and initial node quantity value are added; If the link type has not been recorded, the node type is added in the link node information, and the initial value of the number of nodes corresponding to the type is set to 1, indicating that the time signal passes through the link node of this type for the first time.

[0057] S1035, if recorded, the number of nodes of the type is updated; If the link type already exists in the link node information, the number of nodes of the type is updated by 1, indicating that the time signal passes through another link node of the same type.

[0058] S1036, the updated NTP response message is re-encapsulated and forwarded to the next node.

[0059] The node re-encapsulates the updated traceability information extension field into the NTP response message, ensures the integrity of the message structure and compliance with the protocol standard, and then forwards the message to the next time node or client, realizes the continuous accumulation and transmission of the traceability information.

[0060] Through the above steps, the intermediate node can accurately reflect the hierarchical structure and error accumulation of the time link, provide complete time traceability path information for the terminal device, and improve the reliability and accuracy of the time system.

[0061] S104, when receiving the NTP response message, parsing the provenance information extension field, and determining the credibility and expected accuracy of the received time based on the clock source level information, the time deviation estimation information of the clock source, and the link node information.

[0062] In this step, after the NTP client receives the NTP response message with the provenance information extension field, it first parses the extension field to obtain information such as clock source level, time deviation estimation, and link node structure.

[0063] The client calculates the credibility and synchronization accuracy of the current time source according to the pre-set credibility judgment rule combined with the clock level and cumulative time error estimation. The specific judgment can include: Determine the priority of the time source according to the clock level, for example, preferentially use a primary atomic clock source.

[0064] According to the cumulative time deviation, judge the accuracy of the current time, when the error exceeds the threshold, refuse to synchronize or prompt an exception.

[0065] According to the link node type and quantity, judge whether there are too many intermediate nodes or potential unstable links in the path, which affect the reliability of time synchronization.

[0066] Based on the above analysis results, the client decides whether to adopt the current time synchronization result or take other security methods (such as switching time sources, re-synchronizing, etc.), effectively improving the overall credibility and robustness of the network time system.

[0067] Specifically, refer to Figure 3 , one specific embodiment of step S104 includes: S1041, extract the clock source level field, time deviation estimation information, and link node information in the provenance information extension field; The client extracts the provenance information extension field in the NTP response message to obtain three key fields: clock source level field (Clock Class), time deviation estimation information (Accuracy), and link node information (used to identify the link type and node quantity experienced by the time path).

[0068] S1042, compare the clock source level field and the time deviation estimation information with the local set credibility clock source level threshold and the maximum allowed error threshold, respectively; In this step, the value of the Clock Class field is compared with the local preset trusted clock source level threshold of the client to determine whether the clock source belongs to a high trusted level; at the same time, the time deviation estimation information in the Accuracy field is compared with the local set maximum allowed error threshold; in addition, the total hop count in the link node information can be counted and compared with the set hop count threshold.

[0069] S1043, if the preset trustworthiness judgment condition is met, performing time synchronization; If the comparison result meets the preset trustworthiness judgment condition (for example, Clock Class is higher than the set threshold, the Accuracy value is lower than the maximum error tolerance range, and the hop count does not exceed the preset upper limit), the client determines that the time source represented by the current message is trusted, and the local system time synchronization operation can be performed.

[0070] The trustworthiness judgment condition at least includes one of the following: Condition 1: the value of the clock source level field is higher than the preset trusted level threshold (for example, Clock Class ≤ 6); Condition 2: the time deviation estimation value is less than the set maximum allowed error threshold (for example, less than 100 microseconds); Condition 3: the total node number recorded in the link node information is lower than the hop count threshold (for example, ≤ 5 hops).

[0071] Further, in this embodiment, the value of the Clock Class field can be classified and marked: If the value of the Clock Class field is 1 (for example, atomic clock) or 6 (ePRTC / PRTC normal tracking), it can be marked as a high trusted time source; If the value of the Clock Class field is 7 (ePRTC / PRTC loss of lock) or 52 (free running), it can be marked as a low trusted time source; If the Clock Class field is missing or has an illegal value, it is marked as an unusable source.

[0072] Through the above mechanism, the client can realize dynamic trustworthiness judgment and time synchronization control according to the traceability information of the time source, which significantly improves the security, accuracy guarantee and controllability of NTP time service.

[0073] Further, the value of the Clock Class field can be analyzed, if Clock Class is equal to 1 or 6, it is marked as a high trusted source; if Clock Class is 7 or 52, it is marked as a low trusted or loss of lock source; if Clock Class is missing or has an illegal value, it is marked as unusable.

[0074] In the further embodiment, on the basis of the steps S1042 or S1043, the value of the extracted Clock Class field can be subjected to semantic level analysis to enhance the judgment ability of the client on the trustworthiness of the time source, specifically including: If the value of Clock Class is 1 or 6, it is determined that the message source is a high-trust clock source, such as an atomic clock or an enhanced primary reference clock (ePRTC / PRTC in a normal satellite tracking state), which can be preferentially used for time synchronization; If the value of Clock Class is 7 or 52, it is marked that the message source is a low-trust or lost lock clock source, such as ePRTC / PRTC in a holdover or free running state, which is not recommended to be directly used for time synchronization in principle, unless the system is in a fault-tolerant mode; If the Clock Class field is missing or has an illegal value (such as not within the standard definition range), it is marked as an unusable time source, and the client refuses to synchronize based on the message.

[0075] Through the above further classification and judgment mechanism, the client can not only judge the quantitative indicator of time deviation (Accuracy), but also realize more fine-grained and dynamic time control by combining the state identification of the time source, effectively preventing system clock abnormalities caused by lost lock, drift or pseudo time distribution.

[0076] In a preferred embodiment of the application, the client can judge the trustworthiness of the time source based on the ClockClass field value carried in the NTP response message. To support this judgment logic, Table 4 lists common clock source types and their corresponding Clock Class values, and the state and trustworthiness of each type of time source are described.

[0077] Among them, the time source with Clock Class value of 1 and 6 is considered as a high-trust source, suitable for direct time synchronization; the time source with value of 7 is in a holdover state, with decreased trustworthiness; the time source with value of 52 is in a free running state, which is usually not recommended to be used; if the field is missing or the value is illegal, the time source should be considered as unusable.

[0078] Table 4. Value of Clock Class field and corresponding clock source type description

[0079] S1044, if the preset trustworthiness judgment condition is not met, the synchronization is refused.

[0080] If any of the preset credibility judgment conditions is not met, the client determines that the time source has potential risks or insufficient accuracy, and refuses to perform time synchronization operation based on the NTP response message, so as to ensure the reliability and stability of the system clock.

[0081] The above describes the embodiments of the traceable NTP time service method provided in the application, and the following describes the embodiments of the traceable NTP time service device provided in the application.

[0082] Referring to Figure 4 One embodiment of the traceable NTP time service device provided in the application includes: A message generation unit 401 is configured to generate an NTP response message conforming to the NTPv4 or NTS standard structure, and the NTP response message contains a standard NTP header field. A field extension unit 402 is configured to add a traceable information extension field in the NTP response message, and the traceable information extension field at least includes clock source level information, time deviation estimation information from the clock source, and link node information for representing a time path structure. A message forwarding unit 403 is configured to forward the NTP response message, and each time the forwarding is performed, corresponding node type and node quantity information is added in the traceable information extension field. A message analysis unit 404 is configured to analyze the traceable information extension field after receiving the NTP response message, and determine the credibility and expected accuracy of the received time based on the clock source level information, the time deviation estimation information from the clock source, and the link node information.

[0083] Optionally, the clock source level information is a Clock Class field, and the corresponding value is set by the most upstream clock source in the time link and remains unchanged in the entire time path.

[0084] Optionally, the value of the Clock Class field includes one of the following levels: The atomic clock group is set to 1; The ePRTC or PRTC normally tracking the satellite is set to 6; The ePRTC or PRTC losing the satellite and entering the holdover state is set to 7; The ePRTC or PRTC in the free running state is set to 52.

[0085] Optionally, the time deviation estimation information is an Accuracy field, which is used to represent the cumulative time error between the current node and the clock source, and the corresponding value is accumulated and updated according to the link type each time the NTP response message is forwarded.

[0086] Optionally, the error accumulation update strategy of the Accuracy field comprises: a 2 picosecond accumulation per node for a fiber time link; a 5 nanosecond to 10 microsecond accumulation per node for a PTP time link; a 10 microsecond to 50 millisecond accumulation per node for an NTP time link.

[0087] Optionally, the link node information comprises a plurality of node types and corresponding node numbers, each node type being used to identify a link category experienced by the NTP response message in a transmission path, and the node types comprising: a fiber time link, a PTP time link, and

[0088] an NTP time link. Optionally, the message forwarding unit 403 is specifically configured to: parse the trace information extension field in the received NTP response message; based on the current link type and performance parameter, calculate a time deviation increment value and accumulate it into the time deviation estimation information in the trace information extension field; determine whether the current link type has been recorded in the trace information extension field; if not, append a new node type and an initial node number value; if yes, update the node number of the type; re-encapsulate the updated NTP response message and forward it to a next node.

[0089] Optionally, the message parsing unit 404 is specifically configured to: extract the clock source level field, the time deviation estimation information and the link node information in the trace information extension field; compare the clock source level field and the time deviation estimation information with a preset trusted clock source level threshold and a preset maximum allowed error threshold, respectively; if a preset trustworthiness judgment condition is met, perform time synchronization; if the preset trustworthiness judgment condition is not met, refuse synchronization.

[0090] Optionally, the preset trustworthiness judgment condition comprises at least one of the following: condition 1: the clock source level is higher than the preset trusted clock source level threshold; condition 2: the time deviation estimation information is lower than the preset maximum allowed error threshold; condition 3: the number of link nodes recorded in the NTP response message is lower than a preset hop threshold.

[0091] Optionally, the message analysis unit 404 is specifically configured to: analyze the value of the Clock Class field, if Clock Class is equal to 1 or 6, mark as a high-trust source; if Clock Class is 7 or 52, mark as a low-trust or lost-lock source; if Clock Class is missing or an illegal value, mark as unusable.

[0092] Please refer to Figure 5 The application also provides a traceable NTP time service device, comprising: a processor 501, a memory 502, an input / output unit 503, and a bus 504; The processor 501 is connected with the memory 502, the input / output unit 503, and the bus 504; The memory 502 stores a program, and the processor 501 invokes the program to execute any of the above methods.

[0093] The application also relates to a computer readable storage medium, which stores a program, and when the program runs on a computer, the computer executes any of the above methods.

[0094] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0095] In the several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented by other manners. For example, the above-described device embodiments are only schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.

[0096] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. According to actual needs, part or all of the units can be selected to achieve the purpose of the embodiment scheme.

[0097] In addition, each function unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software function unit.

[0098] When the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present application, essentially or in the form of a contribution to the prior art, or all or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, read-only memory), a random access memory (RAM, random access memory), a magnetic disk or an optical disk, and various media that can store program codes.

Claims

1. A source-tracing NTP time synchronization method, characterized in that, The method includes: Generate an NTP response message that conforms to the NTPv4 or NTS standard structure, the NTP response message containing standard NTP header fields; Add a source information extension field to the NTP response message. The source information extension field includes at least clock source level information, time deviation estimation information from the clock source, and link node information for characterizing the time path structure. The NTP response message is forwarded, and each time it is forwarded, the corresponding node type and node quantity information are appended to the source information extension field; Upon receiving the NTP response message, the extended field of the traceability information is parsed, and the reliability and expected accuracy of the received time are determined based on the clock source level information, the time deviation estimation information from the clock source, and the link node information.

2. The NTP time synchronization method for tracing origins according to claim 1, characterized in that, The clock source level information is the ClockClass field, whose value is set by the upstream clock source in the time chain and remains unchanged throughout the entire time path.

3. The NTP time synchronization method according to claim 2, characterized in that, The value of the Clock Class field includes one of the following levels: The atomic clock group is set to 1; The ePRTC or PRTC setting for normally tracked satellites is 6; The ePRTC or PRTC set to 7 indicates that a lost satellite has entered hold-up status. The ePRTC or PRTC in free-running state is set to 52.

4. The NTP time synchronization method for tracing origins according to claim 1, characterized in that, The time deviation estimation information is the Accuracy field, which represents the cumulative time error between the current node and the clock source. The corresponding value is accumulated and updated according to the link type each time an NTP response message is forwarded.

5. The NTP time synchronization method according to claim 4, characterized in that, The strategy for accumulating and updating the error in the Accuracy field includes: The fiber optic time synchronization link accumulates 2 picoseconds for each node it passes through. The PTP timing link accumulates 5 nanoseconds to 10 microseconds each time it passes through a node; The NTP time synchronization link accumulates 10 microseconds to 50 milliseconds for each node it passes through.

6. The NTP time synchronization method for tracing origins according to claim 1, characterized in that, The link node information includes multiple node types and corresponding node quantities. Each node type identifies the link category traversed by the NTP response message in the transmission path. The node types include: fiber optic time synchronization links, Precision Time Protocol (PTP) links and Network Time Protocol (NTP) links.

7. The NTP time synchronization method according to claim 1, characterized in that, During each NTP response message forwarding process, the following steps are performed: Parse the source information extension field in the received NTP response message; Based on the current link type and performance parameters, calculate the time deviation increment value and add it to the time deviation estimation information in the extended field of the traceability information; Determine whether the current link type has been recorded in the traceability information extended field; If not recorded, add a new node type and an initial number of nodes; If already recorded, update the number of nodes for that type; The updated NTP response message is repackaged and forwarded to the next level node.

8. The NTP time synchronization method according to claim 1, characterized in that, Upon receiving the NTP response message, the process of parsing the extended fields of the traceability information and determining the reliability and expected accuracy of the received time based on the clock source level information, the time deviation estimation information from the clock source, and the link node information includes: Extract the clock source level field, time deviation estimation information, and link node information from the extended fields of the traceability information; The clock source level field and time deviation estimation information are compared with the locally set reliable clock source level threshold and maximum permissible error threshold, respectively. If the preset credibility judgment conditions are met, then time synchronization will be performed. If the preset credibility judgment conditions are not met, synchronization will be refused.

9. The NTP time synchronization method for tracing origins according to claim 8, characterized in that, The preset credibility judgment conditions include at least one of the following: Condition 1: The clock source level is higher than the preset trusted clock source level threshold; Condition 2: The estimated time deviation information is lower than the preset maximum permissible error threshold; Condition 3: The number of link nodes recorded in the NTP response message is lower than the preset hop count threshold.

10. The NTP time synchronization method for tracing origins according to claim 3, characterized in that, Also includes: Analyze the value of the Clock Class field; if Clock Class equals 1 or 6, mark it as a high-trust source. If the Clock Class is 7 or 52, it is marked as a low-trust or unlocked source; If the Clock class is missing or has an illegal value, it is marked as unavailable.

11. A traceable NTP timing device, characterized in that, The device includes: The message generation unit is used to generate an NTP response message that conforms to the NTPv4 or NTS standard structure, wherein the NTP response message contains standard NTP header fields. A field extension unit is used to add a source information extension field to the NTP response message. The source information extension field includes at least clock source level information, time deviation estimation information from the clock source, and link node information for characterizing the time path structure. The message forwarding unit is used to forward the NTP response message, and each time it is forwarded, it appends the corresponding node type and node quantity information to the source information extension field; The message parsing unit is used to parse the extended field of the traceability information after receiving the NTP response message, and determine the reliability and expected accuracy of the received time based on the clock source level information, the time deviation estimation information from the clock source, and the link node information.

12. A traceable NTP time synchronization device, characterized in that, The device includes: Processor, memory, input / output units, and bus; The processor is connected to the memory, the input / output unit, and the bus; The memory stores a program, which the processor invokes to perform the method as described in any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium contains a program that, when executed on a computer, performs the method as described in any one of claims 1 to 10.

Citation Information

Cited By

  • Time service link intrusion detection system for power dispatching

    CN121619256A