A time synchronization method, apparatus, device, and computer-readable storage medium
By obtaining the latest time zone of the operating system from the designated memory in the baseboard management controller and combining it with the real-time clock and time zone update flag, Coordinated Universal Time (UTC) is determined, thus solving the problem of local time error in the BMC and achieving the accuracy of data timestamps.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2026-03-13
AI Technical Summary
The lack of mature time synchronization methods in the existing technology may lead to errors in the local time determined by the baseboard management controller (BMC), which in turn affects the accuracy of data timestamps.
The baseboard management controller determines the Coordinated Universal Time (UTC) by obtaining the latest time zone of the server's operating system from a designated memory, combining the server's real-time clock and the operating system's time zone update flag, and then overlaying the baseboard management controller's latest time zone onto it, thereby accurately determining the local time.
This ensures that the baseboard management controller determines the accurate local time, guaranteeing the accuracy of the data timestamps.
Smart Images

Figure CN119576072B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of servers, and in particular to a time synchronization method, apparatus, device, and computer-readable storage medium. Background Technology
[0002] Time synchronization is a critical factor for the proper functioning of the BMC (Baseboard Management Controller), as all monitoring data and event logs require accurate timestamps. However, the lack of a mature time synchronization method in related technologies leads to errors in the local time determined by the BMC, resulting in incorrect timestamps on the data.
[0003] Therefore, how to provide a solution to the above-mentioned technical problems is a problem that needs to be solved by those skilled in the art. Summary of the Invention
[0004] The purpose of this invention is to provide a time synchronization method, apparatus, device, and computer-readable storage medium. When there is a time synchronization requirement, the Baseboard Management Controller (BMC) can obtain the latest time zone of the server's operating system from a designated memory, and then determine the Coordinated Universal Time (UTC) 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. By superimposing the latest time zone of the Baseboard Management Controller onto the UTC, the local time of the Baseboard Management Controller can be determined, ensuring that the BMC determines an accurate local time and thus guaranteeing the accuracy of the data timestamp.
[0005] To address the aforementioned technical problems, this invention provides a time synchronization method applied to a baseboard management controller, comprising:
[0006] When there is a time synchronization requirement, the latest time zone of the server's operating system is obtained from the specified memory, where the specified memory is used to store the latest time zone of the operating system sent by the operating system;
[0007] Coordinated Universal Time (UTC) 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 operating system.
[0008] The local time of the baseboard management controller is determined by overlaying the latest time zone of the baseboard management controller onto the Coordinated Universal Time.
[0009] On the other hand, 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, Coordinated Universal Time (UTC) is determined as follows:
[0010] Determine whether the timezone update flag is enabled in the operating system;
[0011] If enabled, Coordinated Universal Time (UTC) is obtained by subtracting the latest time zone of the operating system from the server's real-time clock.
[0012] If not enabled, the server's real-time clock will be used as Coordinated Universal Time.
[0013] On the other hand, when time synchronization is required, the time synchronization method further includes the following steps before retrieving the latest time zone of the server's operating system from the designated memory:
[0014] Determine if the server's forced timezone synchronization function is enabled;
[0015] If the forced time zone synchronization function is not enabled, execute the step of obtaining the latest time zone of the server's operating system from the specified memory when there is a time synchronization requirement;
[0016] After determining whether the server's forced timezone synchronization function is enabled, the time synchronization method further includes:
[0017] If the server's forced timezone 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 can assign the time zone of the server's operating system to the latest time zone of the baseboard management controller.
[0019] In response to the time zone assignment command sent by the specified controller, the time zone of the baseboard management controller is assigned to the latest time zone of the operating system sent by the specified controller;
[0020] 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.
[0021] On the other hand, 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:
[0022] When there is a time synchronization requirement, determine whether the time zone update flag in the operating system is enabled;
[0023] If the time zone update flag is enabled in the operating system, the server's real-time clock will be used as the local time of the baseboard management controller.
[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 microcontroller unit in the server, and the designated memory is the memory inside the microcontroller unit.
[0026] To address the aforementioned technical problems, the present invention also provides a time synchronization method, applied to a designated controller in a server, comprising:
[0027] Store the latest timezone of the server's operating system to the designated memory;
[0028] In response to the time zone acquisition command of the baseboard management controller, the latest time zone of the operating system stored in the specified memory is sent to the baseboard management controller so that the baseboard management controller can determine the Coordinated Universal Time (UTC) 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 UTC to determine the local time of the baseboard management controller.
[0029] On the other hand, this time synchronization method also includes:
[0030] Store the latest time zone sent by the baseboard management controller to the designated memory;
[0031] Upon receiving the latest time zone from the operating system or baseboard management controller, determine whether the server's forced time zone synchronization function is enabled;
[0032] If the forced time zone synchronization function is enabled, the latest time zone most recently sent by the target sender will be used as the time zone to be assigned, and the time zone of the target receiver will be assigned as the time zone to be assigned. The target sender is the one in the operating system and the baseboard management controller that most recently sent the latest time zone, and the target receiver is the other one in the operating system and the baseboard management controller besides the target sender.
[0033] To address the aforementioned technical problems, the present invention also provides a time synchronization device applied to a substrate management controller, comprising:
[0034] The first acquisition module is used to acquire the latest time zone of the server's operating system from a specified memory when there is a time synchronization requirement. The specified memory is used to store the latest time zone of the operating system sent by the operating system.
[0035] The first determining module is used to determine 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.
[0036] The second determining module is used to overlay the latest time zone of the baseboard management controller onto the Coordinated Universal Time (UTC) to determine the local time of the baseboard management controller.
[0037] To address the aforementioned technical problems, the present invention also provides a time synchronization device, comprising:
[0038] Memory, used to store computer programs;
[0039] A processor for implementing the time synchronization method described above when executing the computer program.
[0040] To address the aforementioned technical problems, the present invention also provides 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.
[0041] Beneficial Effects: This invention provides a time synchronization method. Considering that the latest time zone of the operating system may differ from that of the baseboard management controller (BMC), and that the BMC can obtain the latest time zone of the operating system stored in a designated memory, the BMC can obtain the latest time zone of the server's operating system from the designated memory when there is a time synchronization requirement. Then, 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 (UTC) is determined. By superimposing the latest time zone of the BMC onto the UTC, the local time of the BMC can be determined, ensuring that the BMC determines an accurate local time and thus guaranteeing the accuracy of the data timestamp.
[0042] The present invention also provides a time synchronization device, apparatus, and computer-readable storage medium, which have the same beneficial effects as the time synchronization method described above. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention, the relevant technologies and the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1 A flowchart illustrating 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 flowchart illustrating another time synchronization method provided by the present invention;
[0047] Figure 4A flowchart illustrating another time synchronization method provided by the present invention;
[0048] Figure 5 A flowchart illustrating another time synchronization method provided by the present invention;
[0049] Figure 6 This is a schematic diagram illustrating the interaction between the OS and the designated controller provided by the present invention.
[0050] Figure 7 This is a schematic diagram illustrating the interaction between the BMC and the designated controller provided by the present invention.
[0051] Figure 8 A flowchart illustrating a time synchronization device provided by the present invention;
[0052] Figure 9 A flowchart of a time synchronization device provided by the present invention;
[0053] Figure 10 This is a flowchart illustrating a computer-readable storage medium provided by the present invention. Detailed Implementation
[0054] The core of this invention is to provide a time synchronization method, apparatus, device, and computer-readable storage medium. When there is a time synchronization requirement, the Baseboard Management Controller (BMC) can obtain the latest time zone of the server's operating system from a designated memory, and then determine the Coordinated Universal Time (UTC) 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. By superimposing the latest time zone of the Baseboard Management Controller onto the UTC, the local time of the Baseboard Management Controller can be determined, ensuring that the BMC determines an accurate local time and thus guaranteeing the accuracy of the data timestamp.
[0055] 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, 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.
[0056] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a time synchronization method provided by the present invention. The time synchronization method is applied to a baseboard management controller and includes:
[0057] S101: When there is a time synchronization requirement, obtain the latest time zone of the server's operating system from the specified memory, wherein the specified memory is used to store the latest time zone of the operating system sent by the operating system;
[0058] Specifically, considering the technical issues mentioned above, and also considering that (1) the basic logic of BMC in determining local time is to superimpose its latest time zone on UTC (Coordinated Universal Time) to obtain the local time of BMC, in the initial case, the UTC stored in OS is the zero time zone time, but OS may "superimpose OS time zone on UTC time" to obtain the RTC (Real-Time Clock) of the server (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 BMC defaults to thinking that the OS time zone is consistent with the BMC time zone and uses the RTC of the server as the local time of BMC, then the local time of BMC will be incorrect. (2) Since in the server, OS (Operating System) The time zones of the System (operating system) and BMC can be set separately. This means that due to user setting errors, 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, the BMC can obtain the contents stored in the specified memory. That is, the specified memory is used as an intermediary to store the latest time zone of the OS. 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 this embodiment of the invention, the OS time zone is obtained through the BMC via a designated memory, and the RTC of the server is also obtained. Then, the UTC is determined based on the OS time zone and the RTC of the server. Finally, the latest time zone of the BMC is superimposed on 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 server's operating system, that is, the latest time zone of the OS, can be obtained from the designated memory.
[0060] It is worth mentioning that the latest time zone of the OS stored in the designated memory can be stored in various ways. For example, it can be the latest time zone of the OS that is periodically obtained from the OS by the designated controller, or it can be the latest time zone of the OS that is actively sent to the designated memory when a time zone update occurs. This embodiment of the invention does not limit this.
[0061] Specifically, the specified memory can be of various types, such as an MCU (Micro-Controller Unit) in a server, which can reduce the need to modify the server and save costs. This embodiment of the invention does not limit the scope of the invention.
[0062] S102: Determine 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;
[0063] Specifically, since the server's real-time clock may be "overlaid with the OS's latest time zone UTC" or it may be UTC itself, and the time zone update flag in the OS can indicate whether "the server's real-time clock overlaid with the OS's latest time zone", the UTC can be determined based on the server's real-time clock by using the OS's time zone update flag, which makes it easier to determine the local time of the BMC. Therefore, in this step, Coordinated Universal Time can be determined based on the server's real-time clock, the operating system's time zone update flag, and the operating system's latest time zone.
[0064] The server's real-time clock and the time zone update flag in the OS can be obtained directly from the OS by the BMC. The acquisition process will not be described in detail in this embodiment of the invention.
[0065] S103: By overlaying the latest time zone of the baseboard management controller onto Coordinated Universal Time, the local time of the baseboard management controller is determined.
[0066] Specifically, after obtaining the 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 this embodiment of the invention is determined "based on the real-time clock of the server and with reference to the latest time zone of the OS", the accurate local time of the BMC can still be determined even if the latest time zone of the OS is different from the latest time zone of the BMC.
[0067] Specifically, for a better explanation of the embodiments of the present invention, please refer to... Figure 2 , Figure 2 This is a schematic diagram of a time synchronization system provided by the present invention. The baseboard management controller can obtain the latest time zone of the operating system from a designated memory. Figure 2 The specified memory can be the internal memory of the controller, and the operating system can send its latest time zone to the specified memory.
[0068] This invention provides a time synchronization method. Considering that the latest time zone of the operating system may differ from that of the baseboard management controller (BMC), and that the BMC can obtain the latest time zone of the operating system stored in a designated memory, the BMC can obtain the latest time zone of the server's operating system from the designated memory when there is a time synchronization requirement. Then, 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 (UTC) is determined. The latest time zone of the BMC is then superimposed on the UTC to determine the local time of the BMC, ensuring that the BMC determines an accurate local time and thus guaranteeing the accuracy of the data timestamp.
[0069] Based on the above embodiments:
[0070] As an optional implementation, determining Coordinated Universal Time (UTC) 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 includes:
[0071] Determine whether the timezone update flag is enabled in the operating system;
[0072] If enabled, Coordinated Universal Time (UTC) is obtained by subtracting the latest time zone of the operating system from the server's real-time clock.
[0073] If not enabled, the server's real-time clock will be used as Coordinated Universal Time.
[0074] Specifically, for a better explanation of the embodiments of the present invention, please refer to... Figure 3 , Figure 3 The flowchart of another time synchronization method provided by the present invention is as follows: After starting, 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, if 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 the UTC. If the time zone update flag is not enabled, the real-time clock of the server can be added to the latest time zone of the BMC to obtain the local time of the BMC.
[0075] Specifically, the enabled state of the time zone update flag indicates that the server's real-time clock is "UTC with the latest OS time zone superimposed," while the disabled state of the time zone update flag indicates that the server's real-time clock is UTC. Therefore, in order to accurately determine the UTC, in this embodiment of the invention, it can first be determined 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 server's real-time clock to obtain Coordinated Universal Time (UTC). If disabled, the server's real-time clock can be used as Coordinated Universal Time, and the obtained UTC can be used as the data basis for subsequent steps.
[0076] As an optional embodiment, when time synchronization is required, the time synchronization method further includes, before obtaining the latest time zone of the server's operating system from a designated memory:
[0077] Determine if the server's forced timezone synchronization function is enabled;
[0078] If the forced time zone synchronization function is not enabled, execute the step of obtaining the latest time zone of the server's operating system from the specified memory when there is a time synchronization requirement;
[0079] After determining whether the server's forced timezone synchronization function is enabled, time synchronization methods also include:
[0080] If the server's forced timezone 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 can assign the time zone of the server's operating system to the latest time zone of the baseboard management controller.
[0082] In response to the time zone assignment command sent by the specified controller, the time zone of the baseboard management controller is assigned to the latest time zone of the operating system sent by the specified controller;
[0083] 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.
[0084] Specifically, considering that users may have a need to "force the OS timezone and BMC timezone to be the same" in certain situations, this embodiment of the invention includes a forced timezone synchronization function to meet this requirement. This function can determine whether the server's forced timezone synchronization function is enabled. If enabled, see [link to relevant documentation]. 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 received time zone (i.e., the time zone to be assigned) to the other party, thereby forcing the BMC and OS to have the same time zone.
[0085] Specifically, considering that the latest time zone of the OS is the same as the latest time zone of the BMC when the forced time zone synchronization function is enabled, it is no longer possible to obtain the latest time zone of the OS. When there is a time synchronization requirement, the local time of the baseboard management controller can be determined directly 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.
[0086] As an optional embodiment, 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:
[0087] When there is a time synchronization requirement, determine whether the time zone update flag in the operating system is enabled;
[0088] If the time zone update flag is enabled in the operating system, the server's real-time clock will be used as the local time of the baseboard management controller.
[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 forced time zone synchronization function is enabled and the time zone update flag is enabled, the server's real-time clock can be considered as UTC overlaid with "OS latest time zone / BMC latest time zone", while when the forced time zone synchronization function is enabled and the time zone update flag is not enabled, the server's real-time clock is simply UTC. Therefore, in this embodiment of the invention, when there is a time synchronization requirement, it is first 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 server's real-time clock 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 overlaid on the server's real-time clock to obtain the local time of the baseboard management controller, thereby enabling a more efficient and accurate determination of the BMC's local time.
[0091] Please refer to Figure 4 , Figure 4 This is a flowchart illustrating another time synchronization method provided by the present invention, which is applied to a designated controller in a server and includes:
[0092] S201: Store the latest timezone of the operating system sent by the server's operating system to the specified memory;
[0093] Specifically, based on the above considerations, if BMC wants to "determine 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 time zone of the OS from the designated memory. From the perspective of the designated controller, the designated controller needs to store the latest time zone of the operating system sent by the server's operating system to the designated memory so that BMC can obtain it later.
[0094] S202: In response to the time zone acquisition command of the baseboard management controller, the latest time zone of the operating system stored in the specified memory is sent to the baseboard management controller so that the baseboard management controller can determine the Coordinated Universal Time (UTC) 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 UTC to determine the local time of the baseboard management controller.
[0095] Specifically, after the latest time zone of the OS is stored in the designated memory, the BMC will send a retrieval command to the designated controller to obtain the latest time zone of the OS when there is a time synchronization requirement. Therefore, in this embodiment of the invention, the designated controller can respond to the time zone retrieval command 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 (UTC) 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; and superimpose the latest time zone of the baseboard management controller on the UTC 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] Store the latest time zone sent by the baseboard management controller to the designated memory;
[0099] Upon receiving the latest time zone from the operating system or baseboard management controller, determine whether the server's forced time zone synchronization function is enabled;
[0100] If the forced time zone synchronization function is enabled, the latest time zone most recently sent by the target sender will be used as the time zone to be assigned, and the time zone of the target receiver will be assigned as the time zone to be assigned. The target sender is the one in the operating system and the baseboard management controller that most recently sent the latest time zone, and the target receiver is the other one in the operating system and the baseboard management controller besides the target sender.
[0101] Specifically, for a better explanation of the embodiments of the present invention, please refer to... Figure 5 , Figure 5 This is a flowchart illustrating another time synchronization method provided by the present invention. Figure 5In this process, the controller can obtain and record the latest time zone of the OS and the latest time zone of the BMC. It can also use the newly received latest time zone as the time zone to be assigned and assign it to the target receiver. When assigning the time zone to be assigned to the target receiver, multiple attempts will be made if the assignment fails. If the assignment still fails after a preset number of attempts, an error can be reported.
[0102] Specifically, for a better explanation of the embodiments of the present invention, please refer to... Figure 6 and Figure 7 , Figure 6 This is a schematic diagram illustrating the interaction between the OS and a designated controller provided by the present invention. Figure 7 This is a schematic diagram illustrating the interaction between the BMC and a designated controller provided by the present invention. Figure 6 and Figure 7 In this system, both the OS and BMC can determine whether the time zone to be updated is consistent with the current time zone when their own time zone is updated. If they are inconsistent, the latest time zone can be sent to the designated controller so that the designated controller can process it accordingly.
[0103] Specifically, based on the above considerations, namely the user's need to force the OS time zone and BMC time zone to be the same, this embodiment of the invention also designs a time zone forced synchronization function. For the designated controller, it can receive the latest time zone sent by the BMC on the one hand, and the latest time zone sent by the OS on the other hand. That is, it can store the latest time zone of the baseboard management controller sent by the baseboard management controller to the designated memory. The condition for triggering the "time zone to be assigned" to be synchronized to "the other one in the OS and BMC besides the sender of the time zone to be assigned" is "receiving any latest time zone". Therefore, the designated controller in this embodiment of the invention can determine whether the server's time zone forced synchronization function is enabled when it receives the latest time zone sent by the operating system or the baseboard management controller. If enabled, the latest time zone 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 as the time zone to be assigned, thereby achieving the forced sameness of "OS time zone and BMC time zone", meeting user needs and improving user experience.
[0104] Furthermore, it's worth mentioning that, due to the designated controller's role as an intermediate manager, it facilitates unified management and control of the OS and BMC's time zones. Therefore, when setting the time zone, a time zone setting command can be sent to the designated controller, simultaneously setting the OS and BMC's time zones with a single command. In other words, the designated controller can respond to the time zone setting command received through the human-machine interface and assign the designated universal time zone to both the OS and BMC, thereby improving time zone setting efficiency. On the other hand, the designated controller can also periodically perform a "consistency check between the latest OS time zone and the latest BMC time zone." This check periodically determines whether the forced time zone synchronization function is enabled. If enabled, it compares the recorded latest BMC time zone with the latest OS time zone. If they are inconsistent, an error is reported to prevent errors in the recorded latest time zone due to various reasons (such as malicious attacks or data corruption), further ensuring the accuracy of the local time.
[0105] As an optional embodiment, the controller is specified as a microcontroller unit in the server, and the memory is specified as the memory inside the microcontroller unit.
[0106] Specifically, the MCU is a device that is already present in the server, and the MCU itself includes memory. Therefore, in this embodiment of the invention, the MCU can be used as the designated controller, and the memory inside the MCU can be used as the designated memory, which can reduce the modification of the server and reduce the cost of downgrading.
[0107] Of course, in addition to this specific example, the designated controller and the designated memory can also be additional devices set in the server, and this embodiment of the invention does not limit them here.
[0108] Please refer to Figure 8 , Figure 8 This is a schematic flowchart of a time synchronization device provided by the present invention. The time synchronization device is applied to a substrate management controller and includes:
[0109] The first acquisition module 81 is used to acquire the latest time zone of the server's operating system from a designated memory when there is a time synchronization requirement. The designated memory is used to store the latest time zone of the operating system sent by the operating system.
[0110] The first determining module 82 is used to determine 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.
[0111] The second determining module 83 is used to overlay the latest time zone of the baseboard management controller onto the Coordinated Universal Time (UTC) to determine the local time of the baseboard management controller.
[0112] As an optional implementation, determining Coordinated Universal Time (UTC) 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 includes:
[0113] Determine whether the timezone update flag is enabled in the operating system;
[0114] If enabled, Coordinated Universal Time (UTC) is obtained by subtracting the latest time zone of the operating system from the server's real-time clock.
[0115] If not enabled, the server's real-time clock will be used as Coordinated Universal Time.
[0116] Based on the above embodiments:
[0117] As an optional embodiment, the time synchronization device further includes:
[0118] The first judgment module is used to determine whether the server's forced time zone synchronization function is enabled. If the forced time zone synchronization function is not enabled, the first acquisition module 81 is triggered. If the forced time zone synchronization function is enabled, 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 a designated memory when the time zone of the baseboard management controller is updated, so that the designated controller can assign the time zone of the server's operating system to the latest time zone of the baseboard management controller.
[0122] The first assignment module is used to respond to the time zone assignment command sent by the specified controller and assign the time zone of the baseboard management controller to the latest time zone of the operating system sent by the specified controller.
[0123] The third determination module is used to determine the local time of the baseboard management controller 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 when there is a time synchronization requirement.
[0124] As an optional embodiment, the third determining module includes:
[0125] The second judgment module is used to determine whether the time zone update flag in the operating system is enabled when there is a time synchronization requirement. If the time zone update flag in the operating system is enabled, the first action module is triggered; if the time zone update flag in the operating system is not enabled, the second action module is triggered.
[0126] The first action module is used to use the server's real-time clock as the local time of the baseboard management controller.
[0127] The second action module is used to overlay the latest time zone of the baseboard management controller onto the real-time clock of the server to obtain the local time of the baseboard management controller.
[0128] For a description of the time synchronization device provided in the embodiments of the present invention, please refer to the aforementioned embodiments of the time synchronization method; the embodiments of the present invention will not be repeated here.
[0129] Please refer to Figure 9 , Figure 9 This invention provides a flowchart illustrating a time synchronization device, which includes:
[0130] Memory 91 is used to store computer programs;
[0131] The processor 92 is used to implement the steps of the time synchronization method as described in the foregoing embodiments when executing a computer program.
[0132] For a description of the time synchronization device provided in the embodiments of the present invention, please refer to the aforementioned embodiments of the time synchronization method; the embodiments of the present invention will not be repeated here.
[0133] Please refer to Figure 10 , Figure 10 This is a flowchart illustrating a computer-readable storage medium provided by the present invention. The computer-readable storage medium 101 stores a computer program 102, which, when executed by a processor, implements the steps of the time synchronization method as described in the foregoing embodiments.
[0134] For a description of the computer-readable storage medium provided in the embodiments of the present invention, please refer to the foregoing embodiments of the time synchronization method; the embodiments of the present invention will not be repeated here.
[0135] This 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 as described in the foregoing embodiments.
[0136] For a description of the computer program product provided in the embodiments of the present invention, please refer to the aforementioned embodiments of the time synchronization method; the embodiments of the present invention will not be repeated here.
[0137] 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 the method section. It should also be noted that in this specification, relational terms such as "first" and "second" are used only 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 thereof 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 a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0138] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily 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 invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A time synchronization method, characterized in that, Applications to baseboard management controllers include: When there is a time synchronization requirement, the latest time zone of the server's operating system is obtained from the specified memory, where the specified memory is used to store the latest time zone of the operating system sent by the operating system; Coordinated Universal Time (UTC) 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 operating system. The local time of the baseboard management controller is determined by overlaying the latest time zone of the baseboard management controller onto the Coordinated Universal Time. Based on the server's real-time clock, the operating system's time zone update flag, and the operating system's latest time zone, Coordinated Universal Time (UTC) is determined as follows: Determine whether the timezone update flag is enabled in the operating system; If enabled, Coordinated Universal Time (UTC) is obtained by subtracting the latest time zone of the operating system from the server's real-time clock; the real-time clock and the time zone update flag are obtained directly from the operating system. If not enabled, the server's real-time clock will be used as Coordinated Universal Time. When time synchronization is required, before retrieving the latest timezone of the server's operating system from the designated storage, the time synchronization method also includes: Determine if the server's forced timezone synchronization function is enabled; If the forced time zone synchronization function is not enabled, execute the step of obtaining the latest time zone of the server's operating system from the specified memory when there is a time synchronization requirement; After determining whether the server's forced timezone synchronization function is enabled, the time synchronization method further includes: If the server's forced timezone 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 can assign the time zone of the server's operating system to the latest time zone of the baseboard management controller. In response to the time zone assignment command sent by the specified controller, the time zone of the baseboard management controller is assigned to the latest time zone of the operating system sent by the specified controller; 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.
2. The time synchronization method according to claim 1, 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. When there is a time synchronization requirement, determine whether the time zone update flag in the operating system is enabled; If the time zone update flag is enabled in the operating system, the server's real-time clock will be 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.
3. The time synchronization method according to claim 1, characterized in that, The designated controller is the microcontroller unit in the server, and the designated memory is the memory inside the microcontroller unit.
4. A time synchronization method, characterized in that, The specified controllers applied to the server include: Store the latest timezone of the server's operating system to the designated memory; In response to the time zone acquisition command of the baseboard management controller, the latest time zone of the operating system stored in the specified memory is sent to the baseboard management controller so that the baseboard management controller can determine the Coordinated Universal Time (UTC) 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 UTC to determine the local time of the baseboard management controller. The process by which the baseboard management controller determines Coordinated Universal Time (UTC) 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 includes: The baseboard management controller determines whether the time zone update flag in the operating system is enabled. If enabled, it subtracts the latest time zone of the operating system from the server's real-time clock to obtain Coordinated Universal Time (UTC). If not enabled, it uses the server's real-time clock as UTC. The real-time clock and the time zone update flag are obtained directly from the operating system by the baseboard management controller. This time synchronization method also includes: Store the latest time zone sent by the baseboard management controller to the designated memory; Upon receiving the latest time zone from the operating system or baseboard management controller, determine whether the server's forced time zone synchronization function is enabled; If the forced time zone synchronization function is enabled, the latest time zone most recently sent by the target sender will be used as the time zone to be assigned, and the time zone of the target receiver will be assigned as the time zone to be assigned. Here, the target sender is the one in the operating system and the baseboard management controller that most recently sent the latest time zone, and the target receiver is the other one in the operating system and the baseboard management controller other than the target sender.
5. A time synchronization device, characterized in that, Applications to baseboard management controllers include: The first acquisition module is used to acquire the latest time zone of the server's operating system from a specified memory when there is a time synchronization requirement. The specified memory is used to store the latest time zone of the operating system sent by the operating system. The first determining module is used to determine 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 second determining module is used to overlay the latest time zone of the baseboard management controller onto the Coordinated Universal Time to determine the local time of the baseboard management controller. Based on the server's real-time clock, the operating system's time zone update flag, and the operating system's latest time zone, Coordinated Universal Time (UTC) is determined as follows: Determine whether the timezone update flag is enabled in the operating system; If enabled, Coordinated Universal Time (UTC) is obtained by subtracting the latest time zone of the operating system from the server's real-time clock; the real-time clock and the time zone update flag are obtained directly from the operating system. If not enabled, the server's real-time clock will be used as Coordinated Universal Time. When time synchronization is required, before retrieving the latest time zone of the server's operating system from the designated memory, the time synchronization device is also used for: Determine if the server's forced timezone synchronization function is enabled; If the forced time zone synchronization function is not enabled, execute the step of obtaining the latest time zone of the server's operating system from the specified memory when there is a time synchronization requirement; The time synchronization device is also used for: If the server's forced timezone 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 can assign the time zone of the server's operating system to the latest time zone of the baseboard management controller. In response to the time zone assignment command sent by the specified controller, the time zone of the baseboard management controller is assigned to the latest time zone of the operating system sent by the specified controller; 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.
6. A time synchronization device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the time synchronization method as described in any one of claims 1 to 4 when executing the computer program.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the time synchronization method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Time synchronization method, system and device of computer management subsystem and storage medium
CN113126694A
Computer, computer time administration method
WO2012117526A1