Time synchronization method, device and equipment and computer readable storage medium
By implementing a time synchronization method in the substrate management controller (BMC), using the specified memory to store the latest time zone of the operating system, combining real-time clock and time zone update flags, coordinated world time (UTC), and superimposing the latest time zone of the BMC on UTC, the problem of time synchronization error in the prior art is solved, ensuring the accuracy of data timestamps.
Patent Information
- Application Number
- CN202411737802.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-11-29
AI Technical Summary
The lack of mature time synchronization methods in the prior art leads to errors in the local time determined by the substrate management controller (BMC), which in turn affects the time stamp accuracy of the data.
By implementing a time synchronization method in the substrate management controller (BMC), using a designated memory to store the latest time zone of the operating system. When there is a time synchronization requirement, the BMC obtains the latest time zone of the operating system from the specified memory, and combines the real-time clock and time zone update flags to determine the coordinated world time (UTC), and then superimposes the latest time zone of the BMC on the UTC to determine the accurate local time.
The accuracy of the local time determined by the BMC is ensured, thereby ensuring the accuracy of the data timestamp, and solving the problem of time synchronization errors in the prior art.
Smart Images

Figure CN119576072A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of servers, and in particular to a time synchronization method, device, equipment and computer-readable storage medium. Background Art
[0002] Time synchronization is a key factor for the normal operation of the BMC (Baseboard Management Controller) because all monitoring data and event logs require accurate timestamps. However, the related technology lacks a mature time synchronization method, which may cause errors in the local time determined by the BMC, resulting in incorrect timestamps of the data.
[0003] Therefore, how to provide a solution to the above technical problems is a problem that those skilled in the art need to solve at present. Summary of the invention
[0004] The purpose of the present invention is to provide a time synchronization method, device, equipment and computer-readable storage medium. When there is a time synchronization demand, the baseboard management controller can obtain the latest time zone of the server's operating system from a designated memory, and then determine the coordinated universal time based on the server's real-time clock, the time zone update flag in the operating system and the latest time zone of the operating system. Then, the latest time zone of the baseboard management controller is superimposed on the coordinated universal time to determine the local time of the baseboard management controller, thereby ensuring that the BMC determines the accurate local time, thereby ensuring the accuracy of the data timestamp.
[0005] In order to solve the above technical problems, the present invention provides a time synchronization method, which is applied to a baseboard management controller, comprising:
[0006] When there is a time synchronization requirement, obtaining the latest time zone of the operating system of the server from a designated storage, wherein the designated storage is used to store the latest time zone of the operating system sent by the operating system;
[0007] Determine the coordinated universal time based on the server's real-time clock, the time zone update flag in the operating system, and the latest time zone of the operating system;
[0008] The latest time zone of the baseboard management controller is superimposed on the coordinated universal time to determine the local time of the baseboard management controller.
[0009] On the other hand, according to the real-time clock of the server, the time zone update flag in the operating system, and the latest time zone of the operating system, the coordinated universal time is determined to include:
[0010] Determine whether the time zone update flag in the operating system is enabled;
[0011] If enabled, the latest time zone of the operating system is subtracted from the server's real-time clock to obtain the coordinated universal time;
[0012] If not enabled, the server's real-time clock is used as Coordinated Universal Time.
[0013] On the other hand, when there is a time synchronization requirement, before obtaining the latest time zone of the operating system of the server from the designated storage, the time synchronization method further includes:
[0014] Determine whether the server's time zone forced synchronization function is enabled;
[0015] If the time zone forced synchronization function is not enabled, execute the step of obtaining the latest time zone of the server's operating system from the specified storage when there is a time synchronization requirement;
[0016] After determining whether the time zone forced synchronization function of the server is enabled, the time synchronization method further includes:
[0017] If the server's time zone mandatory synchronization function is enabled, perform the following steps:
[0018] When the time zone of the baseboard management controller is updated, the latest time zone of the baseboard management controller is stored in the designated memory, so that the designated controller assigns the time zone of the operating system of the server to the latest time zone of the baseboard management controller;
[0019] In response to the time zone assignment instruction sent by the designated controller, assigning the time zone of the baseboard management controller to the latest time zone of the operating system sent by the designated controller;
[0020] When there is a need for time synchronization, the local time of the baseboard management controller is determined according to the real-time clock of the server, the time zone update flag in the operating system, and the latest time zone of the baseboard management controller.
[0021] On the other hand, when there is a need for time synchronization, the local time of the baseboard management controller is determined according to the real-time clock of the server, the time zone update flag in the operating system, and the latest time zone of the baseboard management controller, including:
[0022] When there is a need for time synchronization, determine whether the time zone update flag in the operating system is enabled;
[0023] If the time zone update flag in the operating system is enabled, the server's real-time clock is used as the baseboard management controller's local time;
[0024] If the time zone update flag in the operating system is not enabled, the latest time zone of the baseboard management controller is superimposed on the real-time clock of the server to obtain the local time of the baseboard management controller.
[0025] On the other hand, the designated controller is a micro control unit in the server, and the designated memory is a memory inside the micro control unit.
[0026] In order to solve the above technical problems, the present invention also provides a time synchronization method, which is applied to a designated controller in a server, comprising:
[0027] storing the latest time zone of the operating system sent by the operating system of the server in a designated storage;
[0028] In response to a time zone acquisition instruction of a baseboard management controller, the latest time zone of the operating system stored in a designated memory is sent to the baseboard management controller, so that the baseboard management controller determines the coordinated universal time according to the real-time clock of the server, the time zone update flag in the operating system, and the latest time zone of the operating system; and the latest time zone of the baseboard management controller is superimposed on the coordinated universal time to determine the local time of the baseboard management controller.
[0029] On the other hand, the time synchronization method further includes:
[0030] storing the latest time zone of the baseboard management controller sent by the baseboard management controller in a designated memory;
[0031] Upon receiving the latest time zone sent by the operating system or the baseboard management controller, determining whether the time zone forced synchronization function of the server is enabled;
[0032] If the time zone forced synchronization function is turned on, the latest time zone sent by the target sender is used as the time zone to be assigned, and the time zone of the target receiver is assigned as the time zone to be assigned, where the target sender is the party in the operating system and the baseboard management controller that sent the latest time zone most recently, and the target receiver is the other party in the operating system and the baseboard management controller except the target sender.
[0033] In order to solve the above technical problems, the present invention further provides a time synchronization device, which is applied to a baseboard management controller, comprising:
[0034] A first acquisition module is used to acquire the latest time zone of the operating system of the server from a designated storage when there is a time synchronization requirement, wherein the designated storage is used to store the latest time zone of the operating system sent by the operating system;
[0035] A first determination module, used to determine the coordinated universal time according to the real-time clock of the server, the time zone update flag in the operating system and the latest time zone of the operating system;
[0036] The second determining module is configured to superimpose the latest time zone of the baseboard management controller on the coordinated universal time to determine the local time of the baseboard management controller.
[0037] In order to solve the above technical problems, the present invention further provides a time synchronization device, comprising:
[0038] Memory for storing computer programs;
[0039] A processor is used to implement the steps of the time synchronization method described above when executing the computer program.
[0040] In order to solve the above technical problem, the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the time synchronization method described above are implemented.
[0041] Beneficial effect: The present invention provides a time synchronization method, which takes into account that the latest time zone of the operating system may be different from the latest time zone of the baseboard management controller, and the baseboard management controller can obtain the "latest time zone of the operating system stored in the designated memory". Therefore, in the present invention, the baseboard management controller can obtain the latest time zone of the server's operating system from the designated memory when there is a time synchronization demand, and then determine the coordinated universal time according to the server's real-time clock, the time zone update flag in the operating system and the latest time zone of the operating system, and then superimpose the latest time zone of the baseboard management controller on the coordinated universal time to determine the local time of the baseboard management controller, thereby ensuring that the BMC determines the accurate local time, thereby ensuring the accuracy of the data timestamp.
[0042] The present invention also provides a time synchronization device, equipment and computer-readable storage medium, which have the same beneficial effects as the above time synchronization method. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the relevant technologies and the drawings required for use in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0044] Figure 1 A schematic diagram of a time synchronization method provided by the present invention;
[0045] Figure 2 A schematic diagram of the structure of a time synchronization system provided by the present invention;
[0046] Figure 3 A schematic diagram of a flow chart of another time synchronization method provided by the present invention;
[0047] Figure 4A schematic diagram of a flow chart of another time synchronization method provided by the present invention;
[0048] Figure 5 A schematic diagram of a flow chart of another time synchronization method provided by the present invention;
[0049] Figure 6 A schematic diagram of the interaction between the OS and the specified controller provided by the present invention;
[0050] Figure 7 A schematic diagram of the interaction between the BMC and the designated controller provided by the present invention;
[0051] Figure 8 A schematic diagram of a flow chart of a time synchronization device provided by the present invention;
[0052] Fig. 9 A schematic diagram of a flow chart of a time synchronization device provided by the present invention;
[0053] Fig.10 A flowchart of a computer-readable storage medium provided by the present invention. DETAILED DESCRIPTION
[0054] The core of the present invention is to provide a time synchronization method, device, equipment and computer-readable storage medium. When there is a need for time synchronization, the baseboard management controller can obtain the latest time zone of the server's operating system from a designated memory, and then determine the coordinated universal time based on the server's real-time clock, the time zone update flag in the operating system and the latest time zone of the operating system. Then, the latest time zone of the baseboard management controller is superimposed on the coordinated universal time to determine the local time of the baseboard management controller, thereby ensuring that the BMC determines the accurate local time, thereby ensuring the accuracy of the data timestamp.
[0055] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0056] Please refer to Figure 1 , Figure 1 A schematic flow chart of a time synchronization method provided by the present invention, the time synchronization method is applied to a baseboard management controller, comprising:
[0057] S101: when there is a time synchronization requirement, obtaining the latest time zone of the operating system of the server from a designated storage, wherein the designated storage is used to store the latest time zone of the operating system sent by the operating system;
[0058] Specifically, considering the technical problems in the above background technology, combined with considering (1) the basic logic of BMC to determine the local time is to superimpose its own latest time zone on the basis of UTC (Coordinated Universal Time) to obtain the local time of BMC. In the initial case, the UTC stored in the OS is the zero time zone time, but the OS may "superimpose the OS time zone on the basis of UTC time" to obtain the server's RTC (Real-Time Clock, a hardware clock used in computer systems to provide accurate time information); if the OS time zone is inconsistent with the BMC time zone, but at this time the BMC defaults to the OS time zone being consistent with the BMC time zone and uses the server's RTC as the BMC local time, then the BMC local time will be wrong, (2) because in the server, the OS (Operating The time zones of the operating system and the BMC can be set separately. This means that due to user setting errors and other reasons, the latest time zone of the operating system may be different from the latest time zone of the baseboard management controller. (3) Although the BMC cannot directly obtain the latest time zone of the OS from the OS, it can obtain the content stored in the specified memory, that is, using the specified memory as an intermediary to store the latest time zone of the OS, and then the BMC can obtain "the latest time zone of the operating system stored in the specified memory".
[0059] Specifically, based on the above considerations, in the embodiment of the present invention, it is desired to obtain the OS time zone through the designated memory by the BMC, and simultaneously obtain the RTC of the server, and then determine the UTC according to the OS time zone and the RTC of the server, and then superimpose the latest time zone of the BMC on the basis of the UTC to obtain the local time of the BMC. Therefore, in this step, when there is a time synchronization requirement, the latest time zone of the operating system of the server, that is, the latest time zone of the OS, can be obtained from the designated memory first.
[0060] Among them, it is worth mentioning that the latest time zone of the OS stored in the designated memory can be stored in a variety of ways, for example, it can be periodically obtained from the OS by the designated controller, or it can be the latest time zone of the OS actively sent to the designated memory when the time zone is updated. The embodiments of the present invention are not limited here.
[0061] Specifically, the designated memory may be of various types, for example, an MCU (Micro-Controller Unit) in a server, which can reduce modification of the server and save costs, and the embodiment of the present invention is not limited here.
[0062] S102: Determine the coordinated universal time according to the real-time clock of the server, the time zone update flag in the operating system, and the latest time zone of the operating system;
[0063] Specifically, since the real-time clock of the server may be "UTC with the latest time zone of the OS superimposed" or it may be UTC itself, and the time zone update flag in the OS can indicate "whether the real-time clock of the server is superimposed with the latest time zone of the OS", the UTC can be determined based on the real-time clock of the server through the time zone update flag of the OS, thereby facilitating the determination of the local time of the BMC. Therefore, in this step, the coordinated universal time can be determined based on the real-time clock of the server, the time zone update flag in the operating system and the latest time zone of the operating system.
[0064] The real-time clock of the server and the time zone update flag in the OS can be directly obtained by the BMC from the OS, and the acquisition process thereof will not be described in detail in the embodiment of the present invention.
[0065] S103: Superimposing the latest time zone of the baseboard management controller on the coordinated universal time to determine the local time of the baseboard management controller.
[0066] Specifically, after obtaining UTC, the latest time zone of the BMC can be superimposed on the UTC to determine the local time of the BMC. Even if the latest time zone of the OS is different from the latest time zone of the BMC, since the UTC in the embodiment of the present invention is determined "based on the real-time clock of the server and with reference to the latest time zone of the OS", even if the latest time zone of the OS is different from the latest time zone of the BMC, the accurate local time of the BMC can still be determined.
[0067] Specifically, in order to better illustrate the embodiments of the present invention, please refer to Figure 2 , Figure 2 A schematic diagram of the structure of a time synchronization system provided by the present invention, wherein the baseboard management controller can obtain the latest time zone of the operating system from the specified memory, and the specified memory is Figure 2 The memory in the specified controller can be used, and the operating system can send its latest time zone to the specified memory.
[0068] The present invention provides a time synchronization method. Considering that the latest time zone of an operating system may be different from the latest time zone of a baseboard management controller, and the baseboard management controller can obtain "the latest time zone of the operating system stored in a designated memory", in the present invention, the baseboard management controller can obtain the latest time zone of the operating system of the server from the designated memory when there is a time synchronization demand, and then determine the coordinated universal time according to the real-time clock of the server, the time zone update flag in the operating system and the latest time zone of the operating system, and then superimpose the latest time zone of the baseboard management controller on the coordinated universal time to determine the local time of the baseboard management controller, thereby ensuring that the BMC determines the accurate local time, thereby ensuring the accuracy of the data timestamp.
[0069] Based on the above embodiments:
[0070] As an optional embodiment, determining the coordinated universal time according to the real-time clock of the server, the time zone update flag in the operating system, and the latest time zone of the operating system includes:
[0071] Determine whether the time zone update flag in the operating system is enabled;
[0072] If enabled, the latest time zone of the operating system is subtracted from the server's real-time clock to obtain the coordinated universal time;
[0073] If not enabled, the server's real-time clock is used as Coordinated Universal Time.
[0074] Specifically, in order to better illustrate the embodiments of the present invention, please refer to Figure 3 , Figure 3 A flow chart of another time synchronization method provided by the present invention. After the start, the latest time zone of the OS, the latest time zone of the BMC and the real-time clock of the server can be obtained. Then, when the time zone update flag is enabled, the latest time zone of the OS is subtracted from the real-time clock and the latest time zone of the BMC is added to obtain UTC. When the time zone update flag is not enabled, the latest time zone of the BMC can be added to the real-time clock of the server to obtain the local time of the BMC.
[0075] Specifically, the enabled state of the time zone update flag indicates that the real-time clock of the server belongs to "UTC with the latest time zone of the OS superimposed", and the disabled state of the time zone update flag indicates that the real-time clock of the server is UTC. Therefore, in order to accurately determine UTC, in the embodiment of the present invention, it is first possible to determine whether the time zone update flag in the operating system is enabled. If enabled, the latest time zone of the operating system can be subtracted from the real-time clock of the server to obtain the coordinated universal time. If disabled, the real-time clock of the server can be used as the coordinated universal time, and the obtained UTC can be used as the data basis for subsequent steps.
[0076] As an optional embodiment, when there is a time synchronization requirement, before obtaining the latest time zone of the operating system of the server from the designated storage, the time synchronization method further includes:
[0077] Determine whether the server's time zone forced synchronization function is enabled;
[0078] If the time zone forced synchronization function is not enabled, execute the step of obtaining the latest time zone of the server's operating system from the specified storage when there is a time synchronization requirement;
[0079] After determining whether the time zone mandatory synchronization function of the server is enabled, the time synchronization method further includes:
[0080] If the server's time zone mandatory synchronization function is enabled, perform the following steps:
[0081] When the time zone of the baseboard management controller is updated, the latest time zone of the baseboard management controller is stored in the designated memory, so that the designated controller assigns the time zone of the operating system of the server to the latest time zone of the baseboard management controller;
[0082] In response to the time zone assignment instruction sent by the designated controller, assigning the time zone of the baseboard management controller to the latest time zone of the operating system sent by the designated controller;
[0083] When there is a need for time synchronization, the local time of the baseboard management controller is determined according to the real-time clock of the server, the time zone update flag in the operating system, and the latest time zone of the baseboard management controller.
[0084] Specifically, considering that in some cases, users may have the requirement of "forcing the OS time zone and the BMC time zone to be the same", in order to meet this requirement, a time zone forced synchronization function is designed in the embodiment of the present invention, that is, it can be determined whether the time zone forced synchronization function of the server is turned on. If it is turned on, see Figure 2 As shown, on the one hand, the BMC and OS need to be able to send their latest time zones to the designated memory, and then the designated memory sets the latest time zone received (that is, the time zone to be assigned) to the other party, so as to achieve the mandatory sameness of the BMC and OS time zones.
[0085] Specifically, considering that when the time zone forced synchronization function is turned on, the latest time zone of the OS is the same as the latest time zone of the BMC, the latest time zone of the OS can no longer be obtained. When there is a need for time synchronization, the local time of the baseboard management controller can be determined directly based on the real-time clock of the server, the time zone update flag in the operating system, and the latest time zone of the baseboard management controller.
[0086] As an optional embodiment, when there is a time synchronization requirement, determining the local time of the baseboard management controller according to the real-time clock of the server, the time zone update flag in the operating system, and the latest time zone of the baseboard management controller includes:
[0087] When there is a need for time synchronization, determine whether the time zone update flag in the operating system is enabled;
[0088] If the time zone update flag in the operating system is enabled, the server's real-time clock is used as the baseboard management controller's local time;
[0089] If the time zone update flag in the operating system is not enabled, the latest time zone of the baseboard management controller is superimposed on the real-time clock of the server to obtain the local time of the baseboard management controller.
[0090] Specifically, considering that when the time zone forced synchronization function is turned on and the time zone update flag is enabled, the real-time clock of the server can be considered to be UTC superimposed with the "OS latest time zone / BMC latest time zone", and when the time zone forced synchronization function is turned on and the time zone update flag is not enabled, the real-time clock of the server is UTC. Therefore, in the embodiment of the present invention, first when there is a time synchronization requirement, it is determined whether the time zone update flag in the operating system is enabled. If the time zone update flag in the operating system is enabled, the real-time clock of the server is used as the local time of the baseboard management controller. If the time zone update flag in the operating system is not enabled, the latest time zone of the baseboard management controller is superimposed on the real-time clock of the server to obtain the local time of the baseboard management controller, so that the local time of the BMC can be determined more efficiently and accurately.
[0091] Please refer to Figure 4 , Figure 4 A schematic flow chart of another time synchronization method provided by the present invention, wherein the time synchronization method is applied to a designated controller in a server, comprising:
[0092] S201: storing the latest time zone of the operating system sent by the operating system of the server into a designated memory;
[0093] Specifically, based on the above considerations, if the BMC wants to "determine the coordinated universal time based on the server's real-time clock, the time zone update flag in the operating system, and the latest time zone of the operating system", then it needs to first obtain the latest OS time zone from the designated memory. From the perspective of the designated controller, the designated controller needs to store the latest operating system time zone sent by the server's operating system in the designated memory so that the BMC can obtain it later.
[0094] S202: In response to a time zone acquisition instruction of the baseboard management controller, the latest time zone of the operating system stored in the designated memory is sent to the baseboard management controller, so that the baseboard management controller determines the coordinated universal time according to the real-time clock of the server, the time zone update flag in the operating system and the latest time zone of the operating system; the latest time zone of the baseboard management controller is superimposed on the coordinated universal time to determine the local time of the baseboard management controller.
[0095] Specifically, after the latest OS time zone is stored in the designated memory, since the BMC will send an acquisition instruction to the designated controller to acquire the latest OS time zone when there is a time synchronization demand, the designated controller in the embodiment of the present invention can respond to the time zone acquisition instruction of the baseboard management controller, and send the latest time zone of the operating system stored in the designated memory to the baseboard management controller, so that the baseboard management controller can determine the coordinated universal time according to the real-time clock of the server, the time zone update flag in the operating system and the latest time zone of the operating system; and superimpose the latest time zone of the baseboard management controller on the coordinated universal time to determine the local time of the baseboard management controller.
[0096] Based on the above embodiments:
[0097] As an optional embodiment, the time synchronization method further includes:
[0098] storing the latest time zone of the baseboard management controller sent by the baseboard management controller in a designated memory;
[0099] Upon receiving the latest time zone sent by the operating system or the baseboard management controller, determining whether the time zone forced synchronization function of the server is enabled;
[0100] If the time zone forced synchronization function is turned on, the latest time zone sent by the target sender is used as the time zone to be assigned, and the time zone of the target receiver is assigned as the time zone to be assigned, where the target sender is the party in the operating system and the baseboard management controller that sent the latest time zone most recently, and the target receiver is the other party in the operating system and the baseboard management controller except the target sender.
[0101] Specifically, in order to better illustrate the embodiments of the present invention, please refer to Figure 5 , Figure 5 A schematic diagram of a flow chart of another time synchronization method provided by the present invention, Figure 5In the process, the specified controller can obtain the latest time zone of the OS and record it, obtain the latest time zone of the BMC and record it, and then use the newly received latest time zone as the time zone to be assigned, and assign the time zone to be assigned to the target recipient; wherein, when "assigning the time zone to be assigned to the target recipient", multiple attempts are made in the case of assignment failure, and if the assignment is still not successful after the preset number of attempts, an error may be reported.
[0102] Specifically, in order to better illustrate the embodiments of the present invention, please refer to Figure 6 and Figure 7 , Figure 6 A schematic diagram of the interaction between the OS and the specified controller provided by the present invention, Figure 7 A schematic diagram of the interaction between the BMC and the specified controller provided by the present invention, Figure 6 and Figure 7 In the present invention, when the OS and BMC's own time zone is updated, they can determine whether the time zone to be updated is consistent with the current time zone. If they are inconsistent, the latest time zone can be sent to the designated controller so that the designated controller can perform corresponding processing.
[0103] Specifically, based on the above considerations, that is, the user has a demand to force the OS time zone and the BMC time zone to be the same, so the embodiment of the present invention also designs a time zone forced synchronization function. For the designated controller, on the one hand, it can receive the latest time zone sent by the BMC, and on the other hand, it can also receive the latest time zone sent by the OS, that is, the latest time zone of the baseboard management controller sent by the baseboard management controller can be stored in the designated memory, and the condition for triggering "synchronizing the time zone to be assigned" to "the other one in the OS and the BMC except the sender of the time zone to be assigned" is "receiving any latest time zone". Therefore, the designated controller in the embodiment of the present invention can determine whether the server's time zone forced synchronization function is turned on when receiving the latest time zone sent by the operating system or the baseboard management controller. If it is turned on, the latest time zone most recently sent by the target sender can be used as the time zone to be assigned, and the time zone of the target receiver can be assigned to the time zone to be assigned, thereby achieving the forced sameness of the "OS time zone and the BMC time zone", meeting user needs and improving user experience.
[0104] In addition, it is worth mentioning that due to the status of the designated controller as an intermediate manager, it is convenient to uniformly manage and control the time zones of the OS and BMC through the designated controller. Therefore, when setting the time zone, a time zone setting instruction can be sent to the designated controller, so that the time zones of the OS and BMC can be set simultaneously through a single instruction, that is, the designated controller can respond to the time zone setting instruction received through the human-computer interaction device, and assign the designated universal time zone to the OS and BMC respectively, thereby improving the efficiency of time zone setting. On the other hand, the designated controller can also regularly perform "consistency check of the latest OS time zone and the latest BMC time zone" and "consistency check of the latest OS time zone and the latest BMC time zone", that is, it can regularly determine whether the time zone forced synchronization function is turned on. If it is turned on, it can compare whether the recorded BMC latest time zone is consistent with the OS latest time zone. If they are inconsistent, an error can be reported to prevent the "recorded latest time zone" from errors due to various reasons (such as malicious attacks or data disorder), and further ensure the accuracy of local time.
[0105] As an optional embodiment, the designated controller is a micro control unit in the server, and the designated memory is a memory inside the micro control unit.
[0106] Specifically, the MCU is a device originally provided in the server, and the MCU itself includes a memory. Therefore, in the embodiment of the present invention, the MCU can be used as a designated controller, and the memory inside the MCU can be used as a designated memory, which can reduce the modification of the server and downgrade costs.
[0107] Of course, in addition to this specific example, the designated controller and the designated memory may also be additional devices provided in the server, and the embodiment of the present invention does not limit this.
[0108] Please refer to Figure 8 , Figure 8 A schematic flow chart of a time synchronization device provided by the present invention, wherein the time synchronization device is applied to a baseboard management controller, comprising:
[0109] A first acquisition module 81 is used to acquire the latest time zone of the operating system of the server from a designated storage when there is a time synchronization requirement, wherein the designated storage is used to store the latest time zone of the operating system sent by the operating system;
[0110] A first determination module 82, for determining the coordinated universal time according to the real-time clock of the server, the time zone update flag in the operating system and the latest time zone of the operating system;
[0111] The second determining module 83 is used to superimpose the latest time zone of the baseboard management controller on the coordinated universal time to determine the local time of the baseboard management controller.
[0112] As an optional embodiment, determining the coordinated universal time according to the real-time clock of the server, the time zone update flag in the operating system, and the latest time zone of the operating system includes:
[0113] Determine whether the time zone update flag in the operating system is enabled;
[0114] If enabled, the latest time zone of the operating system is subtracted from the server's real-time clock to obtain the coordinated universal time;
[0115] If not enabled, the server's real-time clock is used as Coordinated Universal Time.
[0116] Based on the above embodiments:
[0117] As an optional embodiment, the time synchronization device further includes:
[0118] A first judgment module is used to judge whether the time zone forced synchronization function of the server is turned on. If the time zone forced synchronization function is not turned on, the first acquisition module 81 is triggered; if the time zone forced synchronization function is turned on, the forced synchronization module is triggered;
[0119] The time synchronization device also includes:
[0120] The forced synchronization module includes:
[0121] The first storage module is used to store the latest time zone of the baseboard management controller in the designated memory when the time zone of the baseboard management controller is updated, so that the designated controller assigns the time zone of the operating system of the server to the latest time zone of the baseboard management controller;
[0122] A first assignment module, configured to assign the time zone of the baseboard management controller to the latest time zone of the operating system sent by the designated controller in response to a time zone assignment instruction sent by the designated controller;
[0123] The third determination module is used to determine the local time of the baseboard management controller according to the real-time clock of the server, the time zone update flag in the operating system and the latest time zone of the baseboard management controller when there is a time synchronization demand.
[0124] As an optional embodiment, the third determining module includes:
[0125] A second judgment module is used to judge whether the time zone update flag in the operating system is enabled when there is a time synchronization demand, and if the time zone update flag in the operating system is enabled, trigger the first action module; if the time zone update flag in the operating system is not enabled, trigger the second action module;
[0126] A first action module is used to use the real-time clock of the server as the local time of the baseboard management controller;
[0127] The second action module is used to superimpose the latest time zone of the baseboard management controller on the real-time clock of the server to obtain the local time of the baseboard management controller.
[0128] For an introduction to the time synchronization device provided in the embodiment of the present invention, please refer to the aforementioned embodiment of the time synchronization method, and the embodiment of the present invention will not be described in detail here.
[0129] Please refer to Fig. 9 , Fig. 9 A schematic diagram of a flow chart of a time synchronization device provided by the present invention, the time synchronization device comprising:
[0130] A memory 91, used for storing computer programs;
[0131] The processor 92 is used to implement the steps of the time synchronization method in the above-mentioned embodiment when executing the computer program.
[0132] For an introduction to the time synchronization device provided in the embodiment of the present invention, please refer to the aforementioned embodiment of the time synchronization method, and the embodiment of the present invention will not be described in detail here.
[0133] Please refer to Fig.10 , Fig.10 This is a flow chart of a computer-readable storage medium provided by the present invention. A computer-readable storage medium 101 stores a computer program 102. When the computer program 102 is executed by a processor, the steps of the time synchronization method in the aforementioned embodiment are implemented.
[0134] For an introduction to the computer-readable storage medium provided in an embodiment of the present invention, please refer to the aforementioned embodiment of the time synchronization method, and the embodiment of the present invention will not be described in detail here.
[0135] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the time synchronization method in the above-mentioned embodiment when the computer program / instruction is executed by a processor.
[0136] For an introduction to the computer program product provided by the embodiment of the present invention, please refer to the aforementioned embodiment of the time synchronization method, and the embodiment of the present invention will not be described in detail here.
[0137] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should also be noted that in this specification, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of more restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or equipment including the element.
[0138] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A time synchronization method, characterized in that: Applicable to baseboard management controllers, including: When there is a time synchronization requirement, obtaining the latest time zone of the operating system of the server from a designated storage, wherein the designated storage is used to store the latest time zone of the operating system sent by the operating system; Determine the coordinated universal time based on the server's real-time clock, the time zone update flag in the operating system, and the latest time zone of the operating system; The latest time zone of the baseboard management controller is superimposed on the coordinated universal time to determine the local time of the baseboard management controller.
2. The time synchronization method according to claim 1, characterized in that: Based on the server's real-time clock, the time zone update flag in the operating system, and the latest time zone of the operating system, the coordinated universal time is determined to include: Determine whether the time zone update flag in the operating system is enabled; If enabled, the latest time zone of the operating system is subtracted from the server's real-time clock to obtain the coordinated universal time; If not enabled, the server's real-time clock is used as Coordinated Universal Time.
3. The time synchronization method according to claim 1 or 2, characterized in that: When there is a time synchronization requirement, before obtaining the latest time zone of the operating system of the server from the designated storage, the time synchronization method further includes: Determine whether the server's time zone forced synchronization function is enabled; If the time zone forced synchronization function is not enabled, execute the step of obtaining the latest time zone of the server's operating system from the specified storage when there is a time synchronization requirement; After determining whether the time zone forced synchronization function of the server is enabled, the time synchronization method further includes: If the server's time zone mandatory synchronization function is enabled, perform the following steps: When the time zone of the baseboard management controller is updated, the latest time zone of the baseboard management controller is stored in the designated memory, so that the designated controller assigns the time zone of the operating system of the server to the latest time zone of the baseboard management controller; In response to the time zone assignment instruction sent by the designated controller, assigning the time zone of the baseboard management controller to the latest time zone of the operating system sent by the designated controller; When there is a need for time synchronization, the local time of the baseboard management controller is determined according to the real-time clock of the server, the time zone update flag in the operating system, and the latest time zone of the baseboard management controller.
4. The time synchronization method according to claim 3, characterized in that: When time synchronization is required, the local time of the baseboard management controller is determined based on the server's real-time clock, the time zone update flag in the operating system, and the latest time zone of the baseboard management controller, including: When there is a need for time synchronization, determine whether the time zone update flag in the operating system is enabled; If the time zone update flag in the operating system is enabled, the server's real-time clock is used as the baseboard management controller's local time; If the time zone update flag in the operating system is not enabled, the latest time zone of the baseboard management controller is superimposed on the real-time clock of the server to obtain the local time of the baseboard management controller.
5. The time synchronization method according to claim 3, characterized in that: The designated controller is a micro control unit in the server, and the designated memory is a memory inside the micro control unit.
6. A time synchronization method, characterized in that: Applies to specific controllers in the server, including: storing the latest time zone of the operating system sent by the operating system of the server in a designated storage; In response to a time zone acquisition instruction of a baseboard management controller, the latest time zone of the operating system stored in a designated memory is sent to the baseboard management controller, so that the baseboard management controller determines the coordinated universal time according to the real-time clock of the server, the time zone update flag in the operating system, and the latest time zone of the operating system; and the latest time zone of the baseboard management controller is superimposed on the coordinated universal time to determine the local time of the baseboard management controller.
7. The time synchronization method according to claim 6, characterized in that: The time synchronization method further includes: storing the latest time zone of the baseboard management controller sent by the baseboard management controller in a designated memory; Upon receiving the latest time zone sent by the operating system or the baseboard management controller, determining whether the time zone forced synchronization function of the server is enabled; If the time zone forced synchronization function is turned on, the latest time zone sent by the target sender is used as the time zone to be assigned, and the time zone of the target receiver is assigned as the time zone to be assigned, where the target sender is the party in the operating system and the baseboard management controller that sent the latest time zone most recently, and the target receiver is the other party in the operating system and the baseboard management controller except the target sender.
8. A time synchronization device, characterized in that: Applicable to baseboard management controllers, including: A first acquisition module is used to acquire the latest time zone of the operating system of the server from a designated storage when there is a time synchronization requirement, wherein the designated storage is used to store the latest time zone of the operating system sent by the operating system; A first determination module, used to determine the coordinated universal time according to the real-time clock of the server, the time zone update flag in the operating system and the latest time zone of the operating system; The second determining module is configured to superimpose the latest time zone of the baseboard management controller on the coordinated universal time to determine the local time of the baseboard management controller.
9. A time synchronization device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the time synchronization method as claimed in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the time synchronization method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method, device and system for automatically deploying and configuring servers in batches
CN111427624A
Time synchronization method, system and device of computer management subsystem and storage medium
CN113126694A
Method for automatically synchronizing real time by OS (Operating System) and related components thereof
CN115021856A
Time synchronization method and device and readable storage medium
CN115826680A
Firmware update method of information processor
JP2015060411A