Time synchronization method, device and equipment and computer readable storage medium

By introducing a database server into the BMC, a dual-link mechanism is implemented, with NTP direct connection synchronization as the primary mechanism and database scheduling synchronization as the secondary mechanism. This solves the time update problem of the BMC when NTP synchronization fails, and improves the reliability and consistency of time synchronization.

CN122018637APending Publication Date: 2026-05-12INSPUR (SHANDONG) COMPUTER TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
INSPUR (SHANDONG) COMPUTER TECH CO LTD
Filing Date
2026-01-29
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

When NTP synchronization fails, BMC lacks an effective time update mechanism, resulting in inaccurate time synchronization and inconsistent times among different BMC devices, which affects operation and maintenance efficiency and system reliability.

Method used

A database server is introduced into the BMC as an intermediate scheduling node. A dual-link mechanism is used, with NTP direct connection synchronization as the primary method and indirect synchronization between the database scheduling and network BMC nodes as the secondary method. The database server records the connectivity status and time data of the NTP server to achieve fault fallback and time reuse.

Benefits of technology

It reduces the probability of synchronization failure caused by a single NTP link failure, improves the real-time performance and accuracy of BMC cluster time synchronization, and ensures the consistency and synchronization efficiency of BMC device time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122018637A_ABST
    Figure CN122018637A_ABST
Patent Text Reader

Abstract

The invention discloses a time synchronization method, device and equipment and a computer readable storage medium, which are applied to the technical field of computers, and comprise the following steps: when a substrate management controller is normally connected with a network time protocol server, obtaining standard time from the network time protocol server; when the substrate management controller is not normally connected with the network time protocol server, standard time is acquired from the database server; the database server is an intermediate scheduling and storage node for centrally storing time synchronization related data of the baseboard management controller; and updating the local time of the baseboard management controller according to the obtained standard time. According to the method, the mode that a traditional BMC is only connected with an NTP server directly for synchronization is broken through, the database server is designed as a core scheduling node, double links with NTP direct connection synchronization as a main link and database scheduling and network BMC node indirect synchronization as an auxiliary link are achieved, and the synchronization failure probability caused by a single NTP link fault is reduced on the aspect of architecture.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a time synchronization method, apparatus, device, and computer-readable storage medium. Background Technology

[0002] The Baseboard Management Controller (BMC) lacks an independent time source and time storage capability, requiring reliance on an external time source for time synchronization. Currently, the BMC primarily uses a Network Time Protocol (NTP) server for this synchronization. However, when the NTP server is unavailable or a connection is not established, the BMC can only synchronize time once via the BIOS (Basic Input Output System) during system boot. If the operating system does not restart in this scenario, the BMC will be unable to obtain any external time updates. This synchronization method has significant limitations; when NTP synchronization fails, the BMC lacks an effective time update mechanism and cannot guarantee the continuous accuracy of its own time. Therefore, it is urgent to optimize the BMC's time synchronization technology to improve its reliability. Summary of the Invention

[0003] In view of this, the purpose of the present invention is to provide a time synchronization method, apparatus, device and computer-readable storage medium, which solves the problem that the BMC lacks an effective time update mechanism when NTP synchronization fails in the prior art.

[0004] To solve the above-mentioned technical problems, the present invention provides a time synchronization method, comprising:

[0005] When the baseboard management controller is normally connected to the network time protocol server, it obtains the standard time from the network time protocol server;

[0006] When the baseboard management controller is not properly connected to the network time protocol server, it obtains the standard time from the database server; the database server is an intermediate scheduling and storage node used to centrally store time synchronization related data of the baseboard management controller.

[0007] The local time of the baseboard management controller is updated based on the obtained standard time.

[0008] On the one hand, when the baseboard management controller is not properly connected to the network time protocol server, it obtains the standard time from the database server, including:

[0009] When the baseboard management controller is not properly connected to the network time protocol server, the baseboard management controller initiates a query request to the database server to filter out the baseboard management controller device records in the database where the network time protocol server connectivity flag is 1; the database is the database deployed in the database server.

[0010] The target baseboard management controller device record is determined based on the baseboard management controller time and the network time protocol server acquisition time recorded in the baseboard management controller device record.

[0011] The target time is obtained from the Network Time Protocol (NTP) server recorded by the target substrate management controller device.

[0012] On one hand, the target baseboard management controller device record is determined based on the baseboard management controller time and network time protocol server acquisition time recorded in the baseboard management controller device record, including:

[0013] Obtain the baseboard management controller time from the baseboard management controller device record and the network time protocol server time;

[0014] The record where the time of the baseboard management controller is consistent with the time obtained by the network time protocol server is used as the target baseboard management controller device record.

[0015] On one hand, extracting the network time protocol server-acquired time from the target baseboard management controller device records as the target time includes:

[0016] If the target substrate management controller device records multiple records, then the record with the latest recording time is selected from the multiple target substrate management controller device records;

[0017] The time obtained from the Network Time Protocol (NTP) server is extracted from the latest record and used as the target time.

[0018] On the one hand, the content recorded in the baseboard management controller device includes:

[0019] The address of the Network Time Protocol (NTP) server, the time obtained by the NTP server, the Internet Protocol address of the baseboard management controller, the Media Access Control (MAC) address of the baseboard management controller, the time of the baseboard management controller, and the flag indicating whether the NTP server can be connected correctly.

[0020] The Internet Protocol address and the Media Access Control address of the baseboard management controller are used as unique identifiers for each record in the database.

[0021] On the one hand, it also includes:

[0022] If no record of a baseboard management controller device with a network time protocol server connectivity flag of 1 and whose baseboard management controller time matches the time obtained by the network time protocol server is found in the database deployed in the database server, then the network time protocol server will return a time acquisition failure message to the baseboard management controller.

[0023] On the one hand, the rules for assigning values ​​to the flags indicating whether the Network Time Protocol (NTP) server can connect correctly include:

[0024] When the system is configured with Network Time Protocol (NTP) server information, if the NTP server fails or the NTP server configuration information is updated to an unconfigured state, the flag indicating whether the NTP server can connect correctly is set to 0.

[0025] When the system is configured with network time protocol server information, if the network time protocol server address is updated again and the network time protocol server record in the database is synchronized, or the network time protocol server can communicate normally, then the flag bit indicating whether the network time protocol server can be connected correctly is set to 1.

[0026] The present invention also provides a time synchronization device, comprising:

[0027] The first acquisition module is used to acquire standard time from the network time protocol server when the baseboard management controller is normally connected to the network time protocol server.

[0028] The second acquisition module is used to acquire standard time from the database server when the baseboard management controller and the network time protocol server are not properly connected; the database server is an intermediate scheduling and storage node for centrally storing time synchronization related data of the baseboard management controller.

[0029] A time synchronization module is used to update the local time of the baseboard management controller according to the acquired standard time.

[0030] The present invention also provides a time synchronization device, comprising:

[0031] Memory, used to store computer programs;

[0032] A processor for implementing the time synchronization method described above when executing the computer program.

[0033] The present invention also provides a computer-readable storage medium storing computer-executable instructions, which, when loaded and executed by a processor, implement the time synchronization method described above.

[0034] The present invention also provides a computer program product, including a computer program / instruction that, when executed by a processor, implements the steps of the time synchronization method described above.

[0035] As can be seen from the above technical solution, when the baseboard management controller is normally connected to the network time protocol server, the present invention obtains the standard time from the network time protocol server; when the baseboard management controller is not normally connected to the network time protocol server, the standard time is obtained from the database server; the database server is an intermediate scheduling and storage node used to centrally store the time synchronization related data of the baseboard management controller; the local time of the baseboard management controller is updated according to the obtained standard time.

[0036] The beneficial effects of this invention are as follows: This invention breaks through the traditional BMC synchronization model that relies solely on a single direct connection to an NTP server. It designs the database server as the core scheduling node, achieving a dual-link system with primary NTP direct connection synchronization and secondary indirect synchronization between the database scheduling and network BMC nodes. This architecturally reduces the probability of synchronization failure caused by a single NTP link failure. Furthermore, through the intermediate hub role of the database server, BMC devices that have successfully synchronized with NTP standard time serve as temporary valid time sources, providing time reuse for other BMC devices in the same network experiencing NTP link failures. This not only provides a fallback mechanism but also improves the time synchronization efficiency of the entire BMC cluster, while ensuring time consistency among BMC devices in the same network. This solves the problem of traditional single BMCs operating independently and lacking a valid time source after a failure.

[0037] In addition, the present invention also provides a time synchronization device, apparatus, and computer-readable storage medium, which also have the above-mentioned beneficial effects. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0039] Figure 1 A flowchart of a time synchronization method provided in an embodiment of the present invention;

[0040] Figure 2 A flowchart illustrating a time synchronization method provided in an embodiment of the present invention;

[0041] Figure 3 This is a schematic diagram of the structure of a time synchronization device provided in an embodiment of the present invention;

[0042] Figure 4 This is a schematic diagram of the structure of a time synchronization device provided in an embodiment of the present invention. Detailed Implementation

[0043] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0044] In recent years, with the advancement of the information and electronic age, the application of Baseboard Management Controllers (BMCs) in the computer field has become increasingly widespread. The BMC plays a crucial role in monitoring server information, enabling it to view hardware information, query BIOS firmware versions, and configure and query network settings. In modern server management architectures, the BMC, as a monitoring core independent of the main system, undertakes key responsibilities such as remote control, fault alarms, and logging. Accurate time synchronization is not only the foundation for consistent log auditing but also a prerequisite for cross-device event tracing, performance analysis, and security compliance. When the BMC times of multiple servers deviate, troubleshooting distributed systems faces the dilemma of "time chaos," severely impacting operational efficiency and system reliability.

[0045] Because the BMC lacks an independent time source and cannot store its own time, it needs to synchronize with an external time source. The current BMC uses an NTP server. NTP is a network protocol used for computer time synchronization, providing accurate time. Currently, the BMC synchronizes and obtains its time through the NTP server when it is active. If the NTP server is unavailable or not connected, the BMC cannot obtain its own time from it. In this case, the BIOS sends its own time to the BMC during system startup. If the NTP server is unavailable and the OS has not been restarted, the BMC cannot obtain its own time.

[0046] Therefore, when BMC is performing time synchronization, if it is unable to obtain NTP time, time synchronization can only be performed when the system is powered on. During BMC operation, time synchronization cannot be completed in real time, which can easily lead to continuous time offset of BMC, inconsistent time among BMCs in the cluster, and the need to restart after fault recovery to synchronize. This greatly reduces the real-time performance and availability of time synchronization, and cannot guarantee the time accuracy of BMC.

[0047] This invention provides a BMC time synchronization method by adding a database server to record NTP records for multiple BMCs. When an NTP server is configured on a BMC and can obtain the time, the local time of the BMC can be updated through the NTP server. However, if an NTP server is configured but cannot obtain the time correctly, the newly added database server can retrieve the optimal time record from the database server and synchronize it to the BMC. This reduces the probability of BMC time synchronization failure, improves the accuracy of the BMC server time, and better meets user experience and satisfaction.

[0048] Please refer to the details. Figure 1 , Figure 1 A flowchart illustrating a time synchronization method provided in an embodiment of the present invention. The method may include:

[0049] S101: When the baseboard management controller is normally connected to the network time protocol server, it obtains the standard time from the network time protocol server.

[0050] The execution subject in this embodiment is a terminal. This embodiment does not limit the type of terminal, as long as it can perform the time synchronization operation. When the Baseboard Management Controller (BMC) and the Network Time Protocol (NTP) server establish a normal network connection and can achieve stable communication and data exchange, the BMC will use the NTP server as the core time source, directly obtaining a unified network standard time from it to complete its own time synchronization operation. This is also the conventional priority execution method for BMC time synchronization. In this embodiment, the BMC can be understood as a server, i.e., a BMC server. A normal connection in this embodiment requires that the user has configured an NTP server on the BMC, and that the NTP server is enabled and fault-free, enabling a normal connection. Time synchronization can then be performed via S101. The phrase "NTP server configured" here refers to the system configuration operation on the BMC side, which involves setting the address of the Network Time Protocol (NTP) server and enabling the NTP time synchronization function. Simply put, it means that the NTP server information to be connected to has been specified in the BMC device's system, laying the basic configuration prerequisite for the BMC to establish a connection with the NTP server and obtain standard time. This operation only means that the NTP server's connection parameters have been preset in the system, and does not mean that a network connection or normal time acquisition can actually be achieved with the NTP server.

[0051] S102: When the baseboard management controller is not properly connected to the network time protocol server, the standard time is obtained from the database server; the database server is an intermediate scheduling and storage node used to centrally store time synchronization related data of the baseboard management controller.

[0052] When the Baseboard Management Controller (BMC) is unable to establish normal network connectivity and data interaction with the Network Time Protocol (NTP) server due to network failure, NTP server malfunction, or other reasons, a fallback time synchronization method will be triggered to obtain the standard time from a pre-built database server. This database server, as an intermediate scheduling and storage node specifically used for centralized storage of various related data required for BMC time synchronization, will provide a usable time source for the BMC at this time, ensuring that the BMC can still complete the time synchronization operation when NTP direct connection synchronization fails.

[0053] Normally, when a user logs into a BMC and connects to the database server, if the BMC is configured with an NTP server address, a record will be made in the database server's database, using the BMC's MAC address and IP address as unique identifiers to distinguish the database record. If the BMC is not configured with an NTP server address, no record will be made in the database server. The database server record will be updated after the NTP server is configured later. Every time the NTP server configuration page is accessed, the database server record will be updated to ensure that the BMC configuration in the database server records is up-to-date and to guarantee the correctness of the database server records.

[0054] Furthermore, the database server stores multiple records, each including: the address of the Network Time Protocol (NTP) server, the NTP server acquisition time, the Internet Protocol (IP) address of the Baseboard Management Controller (BMC), the Media Access Control (MAC) address of the BMC, the BMC time, and a flag indicating whether the NTP server can connect correctly. The BMC's IP address and MAC address serve as unique identifiers for each record in the database. In this embodiment, the database server not only stores basic equipment and time data but also specifically records the connectivity status flag of the NTP server. It also stores the NTP standard time (NTP acquisition time), the BMC local time (BMC time), and can further include the database record time (current time), enabling a global awareness of the overall synchronization link status. Based on this multi-dimensional associated data, it provides dynamic time source scheduling for the BMC to be synchronized, overcoming the limitations of traditional databases that only store single data and lack active scheduling capabilities. Furthermore, unlike the traditional method of identifying devices solely with IP or MAC addresses, the database server combines the BMC's IP (which can be understood as a logical address) and MAC (which can be understood as a physical unique address) as a combined unique identifier. This approach takes into account both the addressability of the network layer and utilizes the hardware uniqueness of the MAC address to avoid device data confusion caused by dynamic IP allocation and address conflicts. This ensures the accuracy and uniqueness of BMC device information in the database and solves the problem of device identification in dynamic network environments using traditional single identifiers.

[0055] Furthermore, the rules for assigning values ​​to the flag indicating whether the Network Time Protocol (NTP) server can connect correctly can include: when the system has NTP server information configured (i.e., the BMC system has an NTP server configured), if the NTP server malfunctions and cannot obtain time, or if the NTP server updates its records again, changing the NTP server configuration information to an unconfigured state, then the flag indicating whether the NTP server can connect correctly is set to 0. When the system has NTP server information configured, if the NTP server updates its records again, re-updating the NTP server address and completing the synchronization update of the NTP server records in the database, or if the NTP server can communicate normally and correctly obtain time, then the flag indicating whether the NTP server can connect correctly is set to 1. If the system does not have NTP server information configured (i.e., no NTP server is configured), then the database server will not record this data; that is, this record does not exist until the user configures the NTP server.

[0056] Furthermore, when the baseboard management controller and the network time protocol server are not properly connected, the standard time is obtained from the database server. Specifically, this may include: when the baseboard management controller and the network time protocol server are not properly connected, the baseboard management controller initiates a query request to the database server to filter out baseboard management controller device records in the database where the network time protocol server connectivity flag is 1; the database is a database deployed in the database server; based on the baseboard management controller time and the network time protocol server acquisition time recorded in the baseboard management controller device records, the target baseboard management controller device record is determined; and the network time protocol server acquisition time is extracted from the target baseboard management controller device record as the target time.

[0057] In this embodiment, when the Baseboard Management Controller (BMC) cannot connect normally to the Network Time Protocol (NTP) server, the BMC proactively initiates a query request to the database server. It first filters out records of other BMC devices with an NTP server connectivity flag of 1 from the server's database. Then, based on the matching of BMC time and NTP acquisition time in these records, it determines the target device record and finally extracts the NTP standard time from the target record as its own synchronization target. This method provides fallback time synchronization after NTP direct connection failure, completing time acquisition without restarting the BMC, improving the real-time performance and availability of time synchronization, while ensuring the accuracy of the BMC time and reducing the probability of synchronization failure due to a single NTP link failure.

[0058] Furthermore, the determination of the target BMC record based on the BMC time and the time obtained from the network time protocol server recorded in the BMC device record can specifically include: obtaining the BMC time and the time obtained from the network time protocol server from the BMC device record; and selecting records where the BMC time and the network time protocol server time are consistent as the target BMC device record. This filtering rule ensures that the BMC corresponding to the target record is a valid device that has successfully synchronized with the NTP standard time, guaranteeing from the source that the extracted time is the accurate NTP standard time. This avoids time deviations in the BMC to be synchronized due to selecting BMC records with outdated times, thus improving the time accuracy of the fallback synchronization method.

[0059] Furthermore, the aforementioned extraction of the network time protocol server time as the target time from the target baseboard management controller device records can specifically include: if there are multiple target baseboard management controller device records, selecting the record with the latest time from these records; and extracting the network time protocol server time from the latest record as the target time. Specifically, this can be implemented by relying on the current time recorded in a single record, determining the latest record based on the current time. By selecting the latest record, it ensures that the BMC to be synchronized obtains the latest NTP standard time, avoiding time synchronization accuracy deviations caused by using expired records, and further improving the accuracy and timeliness of BMC time synchronization in fallback scenarios.

[0060] Furthermore, an NTP connectivity status flag update mechanism is configured for the database server. This mechanism proactively checks the actual connectivity and time synchronization status between each BMC device and the NTP server at preset intervals, synchronously updating the NTP server connectivity status flag and the corresponding BMC device's time data recorded in the database server, rather than relying solely on passive data feedback from a single BMC query. This proactive, timed update of the flag and BMC device time data avoids storing invalid or outdated status and time information in the database, ensuring that the latest and most accurate valid time source data is obtained during BMC fault fallback queries. This eliminates synchronization deviations caused by data lag at the data source. Simultaneously, it eliminates the need for each BMC to actively report its status, reducing communication overhead within the cluster and improving the overall stability and data timeliness of the synchronization system.

[0061] S103: Update the local time of the baseboard management controller according to the acquired standard time.

[0062] Based on the standard time obtained through the different acquisition methods in S101 and S102, it is synchronized / updated to the baseboard controller, thus giving the baseboard management controller a local time.

[0063] Furthermore, if neither of the above-mentioned S101 nor S102 synchronization methods can complete time synchronization, the device will be informed that the time synchronization operation cannot be completed. Specifically, if the BMC cannot connect normally to the NTP server and switches to the database server to obtain standard time, and if no other BMC device record is found in the database deployed on the database server that simultaneously meets the conditions of the NTP server's connectivity status flag being 1 and the BMC time being consistent with the time obtained from the NTP server (i.e., there is no available valid time source), the NTP server will send a time acquisition failure message to the BMC to be synchronized, informing it that the time synchronization operation cannot be completed. In this way, when there is no valid time source that meets the conditions in the database server, the BMC device is not made to wait indefinitely or attempt invalid synchronization. Instead, a time acquisition failure message is directly returned to the BMC, realizing closed-loop processing of the synchronization process. This allows users to perceive the synchronization status in a timely manner, avoids invalid waiting, and solves the problem of no clear feedback and poor user experience after traditional BMC synchronization failures, thus meeting both the technical implementation and user experience requirements.

[0064] The time synchronization method provided in this invention involves the following steps: S101: When the baseboard management controller (BMC) is normally connected to the network time protocol server, it obtains the standard time from the network time protocol server; S102: When the baseboard management controller is not normally connected to the network time protocol server, it obtains the standard time from the database server; the database server is an intermediate scheduling and storage node used to centrally store time synchronization-related data of the baseboard management controller; S103: The local time of the baseboard management controller is updated according to the obtained standard time. This method breaks through the traditional mode of BMC synchronization with only a single direct connection to the NTP server. It designs the database server as the core scheduling node, realizing a dual-link system with NTP direct connection synchronization as the main method and indirect synchronization between the database scheduling and the network BMC node as the auxiliary method. This reduces the probability of synchronization failure caused by a single NTP link failure from an architectural perspective. Furthermore, by leveraging the central role of the database server, BMC devices that have successfully synchronized with NTP standard time are used as temporary valid time sources. This provides time reuse for other BMC devices in the same network that experience NTP link failures, not only providing a fallback solution but also improving the time synchronization efficiency of the entire BMC cluster. Simultaneously, it ensures time consistency among BMC devices in the same network, resolving the traditional problem of individual BMCs operating independently and lacking a valid time source after a failure. Moreover, a three-layered filtering logic is employed: first, valid BMC records with an NTP connectivity flag of 1 are filtered; then, records whose local time matches the NTP acquisition time are matched; finally, the record with the latest database time is selected. This ensures that the BMCs to be synchronized receive the latest, valid, and accurate standard time, avoiding synchronization accuracy deviations caused by invalid or expired time sources.

[0065] For a clearer understanding of this invention, please refer to the following details. Figure 2 , Figure 2 A flowchart illustrating a time synchronization method provided in an embodiment of the present invention may specifically include:

[0066] (1) If the user has configured an NTP server in the BMC system and the NTP server can connect to the BMC normally, the latest time is obtained from the NTP server first to update the BMC time. At this time, the database server correctly records the data. The content of the record includes: the address of the NTP server, the time obtained by the NTP server, the IP of the BMC, the MAC address of the BMC, the BMC time, the flag bit of whether the NTP server can connect correctly and the current time. At this time, the BMC time is obtained from the NTP server and the BMC time is consistent with the time of the NTP server.

[0067] (2) If a user configures an NTP server in the BMC system, but the NTP server cannot be enabled correctly, or the address of the NTP server cannot be pinged, or other NTP servers are faulty, resulting in the inability to obtain the time of the NTP server from the configured address, then the user accesses the database server, finds the record in the database server where the flag bit of whether the NTP server can be connected correctly is 1, indicating that the NTP server in that record is correct and usable, then compares the NTP time and BMC time in that record, takes the record with the same time, takes the time of that record and returns it, and then updates the BMC time. At this time, the BMC server also indirectly obtains the BMC time from the NTP server, avoiding the situation where the NTP server is unusable and the BMC server cannot obtain the latest time correctly, resulting in a large error in the time of the BMC server;

[0068] (3) If the user configures an NTP server in the BMC system, and the NTP server cannot obtain the time correctly, and the machine in the database server also cannot obtain the time correctly, the user will be given a prompt message that the time cannot be obtained, which reduces the probability of BMC time failing to synchronize successfully, improves the accuracy of BMC server time, better meets the user experience and user feelings, and also reduces the possibility of BMC server time errors.

[0069] As can be seen, the method for obtaining BMC time provided in this embodiment differs from the original method in that: Previously, after configuring an NTP server on the BMC server, if the NTP server was unavailable, the BMC server could not obtain the correct time. In this case, the accuracy of the BMC time could not be guaranteed, because if the NTP server was shut down or its network was down, the BMC's time might be incorrect without a OS restart. Therefore, this method of obtaining time had certain drawbacks. This method optimizes the original NTP server acquisition method by adding a device, namely a database server, to the BMC server. This database server is specifically used to record the NTP server's address, the NTP server's acquisition time, the BMC's IP address, the BMC's MAC address, the BMC time, a flag indicating whether the NTP server can connect correctly, and the current time. This allows for filtering from the database server when the configured NTP server is unavailable, selecting a matching time according to the optimal strategy. This improves the accuracy of the BMC server's time acquisition and enhances the user experience.

[0070] The time synchronization device provided in the embodiments of the present invention will be described below. The time synchronization device described below can be referred to in correspondence with the time synchronization method described above.

[0071] Please refer to the details. Figure 3 , Figure 3 A schematic diagram of a time synchronization device provided in an embodiment of the present invention may include:

[0072] The first acquisition module 100 is used to acquire standard time from the network time protocol server when the baseboard management controller is normally connected to the network time protocol server.

[0073] The second acquisition module 200 is used to acquire standard time from the database server when the baseboard management controller and the network time protocol server are not properly connected; the database server is an intermediate scheduling and storage node for centrally storing time synchronization related data of the baseboard management controller.

[0074] The time synchronization module 300 is used to update the local time of the baseboard management controller according to the acquired standard time.

[0075] Furthermore, based on the above embodiments, the second acquisition module 200 may include:

[0076] The first filtering unit is used to initiate a query request to the database server using the baseboard management controller when the baseboard management controller and the network time protocol server are not properly connected, and to filter out the baseboard management controller device records in the database where the network time protocol server connectivity flag is 1; the database is the database deployed in the database server.

[0077] The second filtering unit is used to determine the target baseboard management controller device record based on the baseboard management controller time and the network time protocol server acquisition time recorded in the baseboard management controller device record.

[0078] The determining unit is used to extract the time obtained from the Network Time Protocol server from the records of the target baseboard management controller device as the target time.

[0079] Furthermore, based on the above embodiments, the second screening unit may include:

[0080] A subunit is configured to obtain the baseboard management controller time and the network time protocol server time from the baseboard management controller device record;

[0081] The comparison subunit is used to record the time of the baseboard management controller that is consistent with the time obtained by the network time protocol server as the target baseboard management controller device record.

[0082] Furthermore, based on the above embodiments, the determining unit may include:

[0083] The selection subunit is used to select the record with the latest recording time from the multiple records of the target baseboard management controller device if the target baseboard management controller device records multiple records.

[0084] A subunit is defined for extracting the time obtained from the Network Time Protocol server from the latest record as the target time.

[0085] Furthermore, based on the above embodiments, the content recorded in the baseboard management controller device record includes: the address of the network time protocol server, the time obtained by the network time protocol server, the internet protocol address of the baseboard management controller, the media access control address of the baseboard management controller, the baseboard management controller time, and a flag indicating whether the network time protocol server can be connected correctly; the internet protocol address and the media access control address of the baseboard management controller are used as unique identifiers for a single record in the database.

[0086] Furthermore, based on any of the above embodiments, the time synchronization device may further include:

[0087] The failure return module is used to return a time acquisition failure prompt message to the baseboard management controller using the network time protocol server if no record of a baseboard management controller device with a network time protocol server connectivity flag of 1 and a baseboard management controller time that is consistent with the time obtained by the network time protocol server is found in the database deployed in the database server.

[0088] Furthermore, based on any of the above embodiments, the rule for assigning the flag bit indicating whether the Network Time Protocol (NTP) server can connect correctly may specifically include: when NTP server information is configured in the system, if the NTP server malfunctions or the NTP server configuration information is updated to an unconfigured state, then the flag bit indicating whether the NTP server can connect correctly is assigned a value of 0; when NTP server information is configured in the system, if the NTP server address is updated again and the NTP server record in the database is synchronized and updated, or the NTP server can communicate normally, then the flag bit indicating whether the NTP server can connect correctly is assigned a value of 1.

[0089] It should be noted that the order of the modules and units in the aforementioned time synchronization device can be changed without affecting the logic.

[0090] The time synchronization device provided in this embodiment of the invention includes a first acquisition module 100, which acquires standard time from the network time protocol server when the baseboard management controller (BMC) is normally connected to the network time protocol server; and a second acquisition module 200, which acquires standard time from a database server when the BMC is not normally connected to the network time protocol server. The database server is an intermediate scheduling and storage node for centrally storing time synchronization-related data of the BMC. The time synchronization module 300 updates the local time of the BMC based on the acquired standard time. This device breaks through the traditional mode of BMC synchronization with only a single direct connection to an NTP server. By designing the database server as the core scheduling node, it achieves a dual-link system with NTP direct connection synchronization as the primary method and indirect synchronization between the database scheduling and network BMC nodes as a secondary method, thus reducing the probability of synchronization failure caused by a single NTP link failure from an architectural perspective. Furthermore, by leveraging the central role of the database server, BMC devices that have successfully synchronized with NTP standard time are used as temporary valid time sources to provide time reuse for other BMC devices in the same network that have experienced NTP link failures. This not only provides a fallback solution but also improves the time synchronization efficiency of the entire BMC cluster. At the same time, it ensures the consistency of time among BMC devices in the same network, solving the problem of traditional single BMCs operating independently and lacking a valid time source after a failure.

[0091] Figure 4 This is a schematic diagram of the structure of a time synchronization device provided in an embodiment of the present invention, as shown below. Figure 4 As shown, the time synchronization device includes:

[0092] Memory 60 is used to store computer programs;

[0093] The processor 61 is used to implement the steps of the time synchronization method as described in the above embodiments when executing a computer program.

[0094] The time synchronization device provided in this embodiment may include, but is not limited to, smartphones, tablets, laptops, or desktop computers.

[0095] The processor 61 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 61 may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 61 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 61 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 61 may also include an Artificial Intelligence (AI) processor, which handles computational operations related to machine learning.

[0096] The memory 60 may include one or more computer-readable storage media, which may be non-transitory. The memory 60 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 60 is used to store at least the following computer program 601, which, after being loaded and executed by the processor 61, is capable of implementing the relevant steps of the time synchronization method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 60 may also include an operating system 602 and data 603, and the storage method may be temporary or permanent storage. The operating system 602 may include Windows, Unix, Linux, etc. The data 603 may include, but is not limited to, the data in the time synchronization method.

[0097] In some embodiments, the time synchronization device may further include a display screen 62, an input / output interface 63, a communication interface 64, a power supply 65, and a communication bus 66.

[0098] Those skilled in the art will understand that Figure 4 The structure shown does not constitute a limitation on the time synchronization device and may include more or fewer components than illustrated.

[0099] It is understood that if the time synchronization method in the above embodiments is implemented as a software functional 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 solution of the present invention, in essence, or the part that contributes to the current technology, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods in the various embodiments of the present invention. The aforementioned storage medium includes: USB flash drive, mobile hard drive, read-only memory (ROM), random access memory (RAM), electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, magnetic disk, or optical disk, and other media capable of storing program code.

[0100] Based on this, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the time synchronization method described above.

[0101] The following describes a computer program product provided by an embodiment of this application. The computer program product described below can be referred to in conjunction with other embodiments described herein.

[0102] A computer program product includes a computer program / instructions that, when executed by a processor, implement the steps of the aforementioned disclosed time synchronization method.

[0103] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0104] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0105] Finally, it should be noted that in this document, relationships such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0106] The present invention provides a detailed description of a time synchronization method, apparatus, device, and computer-readable storage medium. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A time synchronization method, characterized in that, include: When the baseboard management controller is normally connected to the network time protocol server, it obtains the standard time from the network time protocol server; When the baseboard management controller is not properly connected to the network time protocol server, it obtains the standard time from the database server. The database server is an intermediate scheduling and storage node used for centralized storage of time synchronization related data of the baseboard management controller; The local time of the baseboard management controller is updated based on the obtained standard time.

2. The time synchronization method according to claim 1, characterized in that, When the baseboard management controller is not properly connected to the network time protocol server, it obtains the standard time from the database server, including: When the baseboard management controller is not properly connected to the network time protocol server, the baseboard management controller initiates a query request to the database server to filter out the baseboard management controller device records in the database where the network time protocol server connectivity flag is 1; the database is the database deployed in the database server. The target baseboard management controller device record is determined based on the baseboard management controller time and the network time protocol server acquisition time recorded in the baseboard management controller device record. The target time is obtained from the Network Time Protocol (NTP) server recorded by the target substrate management controller device.

3. The time synchronization method according to claim 2, characterized in that, Based on the baseboard management controller time and the network time protocol server acquisition time recorded in the baseboard management controller device record, the target baseboard management controller device record is determined, including: Obtain the baseboard management controller time from the baseboard management controller device record and the network time protocol server time; The record where the time of the baseboard management controller is consistent with the time obtained by the network time protocol server is used as the target baseboard management controller device record.

4. The time synchronization method according to claim 2, characterized in that, Extracting the network time protocol server time from the target baseboard management controller device records as the target time includes: If the target substrate management controller device records multiple records, then the record with the latest recording time is selected from the multiple target substrate management controller device records; The time obtained from the Network Time Protocol (NTP) server is extracted from the latest record and used as the target time.

5. The time synchronization method according to claim 2, characterized in that, The contents recorded in the baseboard management controller device record include: The address of the Network Time Protocol (NTP) server, the time obtained by the NTP server, the Internet Protocol address of the baseboard management controller, the Media Access Control (MAC) address of the baseboard management controller, the time of the baseboard management controller, and the flag indicating whether the NTP server can be connected correctly. The Internet Protocol address and the Media Access Control address of the baseboard management controller are used as unique identifiers for each record in the database.

6. The time synchronization method according to any one of claims 1 to 5, characterized in that, Also includes: If no record of a baseboard management controller device with a network time protocol server connectivity flag of 1 and whose baseboard management controller time matches the time obtained by the network time protocol server is found in the database deployed in the database server, then the network time protocol server will return a time acquisition failure message to the baseboard management controller.

7. The time synchronization method according to claim 1, characterized in that, The rules for assigning values ​​to the flags indicating whether a Network Time Protocol (NTP) server can connect correctly include: When the system is configured with Network Time Protocol (NTP) server information, if the NTP server fails or the NTP server configuration information is updated to an unconfigured state, the flag indicating whether the NTP server can connect correctly is set to 0. When the system is configured with network time protocol server information, if the network time protocol server address is updated again and the network time protocol server record in the database is synchronized, or the network time protocol server can communicate normally, then the flag bit indicating whether the network time protocol server can be connected correctly is set to 1.

8. A time synchronization device, characterized in that, include: The first acquisition module is used to acquire standard time from the network time protocol server when the baseboard management controller is normally connected to the network time protocol server. The second acquisition module is used to obtain standard time from the database server when the baseboard management controller and the network time protocol server are not properly connected. The database server is an intermediate scheduling and storage node used for centralized storage of time synchronization related data of the baseboard management controller; A time synchronization module is used to update the local time of the baseboard management controller according to the acquired standard time.

9. A time synchronization device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the time synchronization method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when loaded and executed by a processor, implement the time synchronization method as described in any one of claims 1 to 7.