[go: up one dir, main page]

CN117148918A - Method, device, equipment and medium for calibrating server time - Google Patents

Method, device, equipment and medium for calibrating server time Download PDF

Info

Publication number
CN117148918A
CN117148918A CN202311104189.4A CN202311104189A CN117148918A CN 117148918 A CN117148918 A CN 117148918A CN 202311104189 A CN202311104189 A CN 202311104189A CN 117148918 A CN117148918 A CN 117148918A
Authority
CN
China
Prior art keywords
time
real
current
server
management controller
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311104189.4A
Other languages
Chinese (zh)
Inventor
严宗玮
林玉兵
张旭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Shandong Computer Technology Co Ltd
Original Assignee
Inspur Shandong Computer Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Shandong Computer Technology Co Ltd filed Critical Inspur Shandong Computer Technology Co Ltd
Priority to CN202311104189.4A priority Critical patent/CN117148918A/en
Publication of CN117148918A publication Critical patent/CN117148918A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/04Generating or distributing clock signals or signals derived directly therefrom
    • G06F1/12Synchronisation of different clock signals provided by a plurality of clock generators
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/04Generating or distributing clock signals or signals derived directly therefrom
    • G06F1/14Time supervision arrangements, e.g. real time clock
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Electric Clocks (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a method, a device, equipment and a medium for calibrating server time, which relate to the technical field of servers and comprise the following steps: when the server is in a first state which is electrified and not started currently, controlling the BMC to read the current time of a first real-time clock in the server, and setting the current time of the first real-time clock as the current core time of the BMC; an energy storage device for supplying power to the first real-time clock is arranged at the non-main board position of the server; when the server is in a second state in which the server is started, acquiring the current time of a second real-time clock on a server main board, and when the current time of the second real-time clock is inconsistent with the current core time of the BMC, performing calibration update on the current core time of the BMC based on the current time of the second real-time clock; and sending the updated current core time of the BMC to the first real-time clock, and updating the current time of the first real-time clock. And synchronizing time information of the whole system, so that the system time of the whole server is kept up to date and accurate.

Description

一种服务器时间校准方法、装置、设备及介质A server time calibration method, device, equipment and medium

技术领域Technical field

本发明涉及服务器技术领域,特别涉及一种服务器时间校准方法、装置、设备及介质。The present invention relates to the field of server technology, and in particular to a server time calibration method, device, equipment and medium.

背景技术Background technique

在目前广泛应用的技术环境下,服务器通常只配备一个实时时钟RTC(Real-TimeClock,实时时钟)设备,其主要职能是为BIOS(Basic Input/Output System,基本输入输出系统)提供服务。对于未接入互联网的服务器,当没有NTP(Network Time Protocol,网络时间协议)服务可用时,BMC(Baseboard Management Controller,基板管理控制器)将只能依赖于与BIOS的时间同步来获取当前时间。而这种同步过程只在每次操作系统启动过程中进行。由于没有NTP服务的外部时间校准,只能依赖内部的RTC设备,这可能使得服务器时间并不总是与实际时间完全一致。在服务器未开机的状态下,虽然主板电源已经为BMC提供了启动能力,但由于BIOS还未进行初始化以及与BMC进行信息交互,此时的BMC并不能从硬件获取到任何有效的时间信息。因此,此段时间内,BMC上显示的时间并非真实的系统时间,只是一个初始设定值,没有实际的参考意义。In the current widely used technical environment, servers are usually equipped with only a real-time clock (RTC) device, whose main function is to provide services for the BIOS (Basic Input/Output System). For servers that are not connected to the Internet, when no NTP (Network Time Protocol) service is available, the BMC (Baseboard Management Controller) will only rely on time synchronization with the BIOS to obtain the current time. This synchronization process is only performed during each operating system startup. Since there is no external time calibration of the NTP service, it can only rely on the internal RTC device, which may make the server time not always exactly consistent with the actual time. When the server is not powered on, although the motherboard power supply has provided the BMC with the startup capability, the BMC cannot obtain any valid time information from the hardware because the BIOS has not yet been initialized and interacted with the BMC. Therefore, during this period, the time displayed on the BMC is not the real system time, but is only an initial setting value and has no actual reference significance.

综上,对于未接入互联网的服务器,如何实现服务器处于不同状态时,其内部的BMC以及服务器内部其他部分的时间一致且准确是本领域有待解决的技术问题。In summary, for servers that are not connected to the Internet, how to ensure that the time of the internal BMC and other parts of the server is consistent and accurate when the server is in different states is a technical problem to be solved in this field.

发明内容Contents of the invention

有鉴于此,本发明的目的在于提供一种服务器时间校准方法、装置、设备及介质,能够对于未接入互联网的服务器,实现服务器处于不同状态时,其内部的BMC以及服务器内部其他部分的时间一致且准确。其具体方案如下:In view of this, the purpose of the present invention is to provide a server time calibration method, device, equipment and medium, which can realize the time of the internal BMC and other parts of the server when the server is in different states for a server that is not connected to the Internet. Consistent and accurate. The specific plan is as follows:

第一方面,本申请公开了一种服务器时间校准方法,包括:In the first aspect, this application discloses a server time calibration method, including:

当检测到服务器当前处于已上电且未启动的第一状态,则控制基板管理控制器读取所述服务器中预先配置的第一实时时钟的当前时间,并将所述第一实时时钟的当前时间设置为所述基板管理控制器的当前内核时间,以便所述服务器的日志系统在所述第一状态下基于所述基板管理控制器的当前内核时间进行日志记录;所述服务器中的非主板位置上设有为所述第一实时时钟供电的储能器件;When it is detected that the server is currently in the first state of being powered on and not started, the baseboard management controller reads the current time of the first real-time clock preconfigured in the server, and sets the current time of the first real-time clock to The time is set to the current core time of the baseboard management controller, so that the log system of the server performs logging based on the current core time of the baseboard management controller in the first state; the non-mainboard in the server An energy storage device is provided at the position to power the first real-time clock;

当检测到所述服务器处于正在启动的第二状态,则获取服务器主板上的第二实时时钟的当前时间,并在所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间不一致时,基于所述第二实时时钟的当前时间对所述基板管理控制器的当前内核时间进行校准,以更新所述基板管理控制器的当前内核时间;When it is detected that the server is in the second state of starting, the current time of the second real-time clock on the server motherboard is obtained, and the current time of the second real-time clock is compared with the current core time of the baseboard management controller. When inconsistent, calibrating the current core time of the baseboard management controller based on the current time of the second real-time clock to update the current core time of the baseboard management controller;

将所述基板管理控制器的当前内核时间发送至所述第一实时时钟,以便利用所述基板管理控制器的当前内核时间对所述第一实时时钟的当前时间进行更新。The current core time of the baseboard management controller is sent to the first real-time clock, so that the current time of the first real-time clock is updated with the current core time of the baseboard management controller.

可选的,所述当检测到所述服务器处于正在启动的第二状态,则获取服务器主板上的第二实时时钟的当前时间,并在所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间不一致时,基于所述第二实时时钟的当前时间对所述基板管理控制器的当前内核时间进行校准,以更新所述基板管理控制器的当前内核时间,包括:Optionally, when it is detected that the server is in the second state of starting, the current time of the second real-time clock on the server mainboard is obtained, and the current time of the second real-time clock is compared with the baseboard management When the current core time of the controller is inconsistent, calibrate the current core time of the baseboard management controller based on the current time of the second real-time clock to update the current core time of the baseboard management controller, including:

当所述服务器上电后,检测所述服务器是否处于正在启动的第二状态;After the server is powered on, detect whether the server is in the second state of starting;

若检测到所述服务器处于正在启动的第二状态,则控制基本输入输出系统进行启动初始化操作;If it is detected that the server is in the second state of starting, then control the basic input and output system to perform a startup initialization operation;

当所述基本输入输出系统的启动初始化完成后,控制所述基本输入输出系统从服务器主板上的第二实时时钟中获取所述第二实时时钟的当前时间,并通过所述基本输入输出系统将包含所述第二实时时钟的当前时间的系统事件日志通过系统事件日志命令同步至所述基板管理控制器;After the startup initialization of the basic input and output system is completed, the basic input and output system is controlled to obtain the current time of the second real-time clock from the second real-time clock on the server motherboard, and use the basic input and output system to obtain the current time of the second real-time clock. Synchronizing a system event log containing the current time of the second real-time clock to the baseboard management controller through a system event log command;

通过所述基板管理控制器解析所述系统事件日志,以获取所述第二实时时钟的当前时间;Parse the system event log through the baseboard management controller to obtain the current time of the second real-time clock;

检测所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间是否一致;Detect whether the current time of the second real-time clock is consistent with the current core time of the baseboard management controller;

若所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间不一致,则利用所述第二实时时钟的当前时间对所述基板管理控制器的当前内核时间进行校准,以更新所述基板管理控制器的当前内核时间。If the current time of the second real-time clock is inconsistent with the current core time of the baseboard management controller, use the current time of the second real-time clock to calibrate the current core time of the baseboard management controller to update The current core time of the baseboard management controller.

可选的,所述检测所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间是否一致之后,还包括:Optionally, after detecting whether the current time of the second real-time clock is consistent with the current core time of the baseboard management controller, the method further includes:

若所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间一致,则选择不对所述基板管理控制器的当前内核时间进行校准处理,以保持所述基板管理控制器的当前内核时间不变。If the current time of the second real-time clock is consistent with the current core time of the baseboard management controller, then choose not to calibrate the current core time of the baseboard management controller to maintain the current core time of the baseboard management controller. Kernel time remains unchanged.

可选的,所述将所述基板管理控制器的当前内核时间发送至所述第一实时时钟,以便利用所述基板管理控制器的当前内核时间对所述第一实时时钟的当前时间进行更新,包括:Optionally, the current core time of the baseboard management controller is sent to the first real-time clock, so as to update the current time of the first real-time clock using the current core time of the baseboard management controller. ,include:

检测所述服务器当前是否处于已开机的第三状态;Detect whether the server is currently in a third state of being powered on;

若当检测到所述服务器当前处于已开机的第三状态,则控制所述基板管理控制器发送所述基板管理控制器的当前内核时间至所述第一实时时钟,以便所述第一实时时钟利用所述当前内核时间对所述第一实时时钟的当前时间进行更新。If it is detected that the server is currently in a third state of being powered on, the baseboard management controller is controlled to send the current core time of the baseboard management controller to the first real-time clock, so that the first real-time clock The current time of the first real-time clock is updated using the current kernel time.

可选的,所述控制基板管理控制器读取所述服务器中预先配置的第一实时时钟的当前时间,包括:Optionally, the control baseboard management controller reads the current time of the first real-time clock preconfigured in the server, including:

控制基板管理控制器通过集成电路总线接口读取所述服务器中预先配置的第一实时时钟的当前时间;Control the baseboard management controller to read the current time of the first real-time clock preconfigured in the server through the integrated circuit bus interface;

相应的,所述控制所述基板管理控制器发送所述基板管理控制器的当前内核时间至所述第一实时时钟,包括:Correspondingly, controlling the baseboard management controller to send the current core time of the baseboard management controller to the first real-time clock includes:

控制所述基板管理控制器并通过所述集成电路总线接口将所述基板管理控制器的当前内核时间写入所述第一实时时钟。Control the baseboard management controller and write the current core time of the baseboard management controller into the first real-time clock through the integrated circuit bus interface.

可选的,所述的服务器时间校准方法,还包括:Optionally, the server time calibration method also includes:

设置时间同步任务;Set time synchronization tasks;

定时触发所述时间同步任务,以依次按照所述第二实时时钟的时间、所述基本输入输出系统的时间、所述基板管理控制器的时间和所述第一实时时钟的时间的同步更新优先级顺序执行时间同步更新操作。The time synchronization task is triggered regularly to prioritize synchronization updates based on the time of the second real-time clock, the time of the basic input and output system, the time of the baseboard management controller, and the time of the first real-time clock. Time synchronization update operations are performed sequentially.

可选的,所述的服务器时间校准方法,所述第一实时时钟和所述储能器件均设置于独立于所述服务器主板的目标电路板上。Optionally, in the server time calibration method, the first real-time clock and the energy storage device are arranged on a target circuit board independent of the server mainboard.

第二方面,本申请公开了一种服务器时间校准装置,包括:In a second aspect, this application discloses a server time calibration device, including:

第一时间获取模块,用于当检测到服务器当前处于已上电且未启动的第一状态,则控制基板管理控制器读取所述服务器中预先配置的第一实时时钟的当前时间,并将所述第一实时时钟的当前时间设置为所述基板管理控制器的当前内核时间,以便所述服务器的日志系统在所述第一状态下基于所述基板管理控制器的当前内核时间进行日志记录;所述服务器中的非主板位置上设有为所述第一实时时钟供电的储能器件;A first time acquisition module, configured to, when detecting that the server is currently in a first state of being powered on and not started, control the baseboard management controller to read the current time of the first real-time clock preconfigured in the server, and The current time of the first real-time clock is set to the current core time of the baseboard management controller, so that the log system of the server performs logging based on the current core time of the baseboard management controller in the first state. ; An energy storage device that supplies power to the first real-time clock is provided at a non-mainboard position in the server;

时间校准模块,用于当检测到所述服务器处于正在启动的第二状态,则获取服务器主板上的第二实时时钟的当前时间,并在所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间不一致时,基于所述第二实时时钟的当前时间对所述基板管理控制器的当前内核时间进行校准,以更新所述基板管理控制器的当前内核时间;A time calibration module, configured to obtain the current time of the second real-time clock on the server motherboard when it is detected that the server is in the second state of starting, and compare the current time of the second real-time clock with the baseboard management When the current core time of the controller is inconsistent, calibrate the current core time of the baseboard management controller based on the current time of the second real-time clock to update the current core time of the baseboard management controller;

第一时间更新模块,用于将所述基板管理控制器的当前内核时间发送至所述第一实时时钟,以便利用所述基板管理控制器的当前内核时间对所述第一实时时钟的当前时间进行更新。A first time update module configured to send the current core time of the baseboard management controller to the first real-time clock, so as to use the current core time of the baseboard management controller to update the current time of the first real-time clock. Make an update.

第三方面,本申请公开了一种电子设备,包括:In a third aspect, this application discloses an electronic device, including:

存储器,用于保存计算机程序;Memory, used to hold computer programs;

处理器,用于执行所述计算机程序,以实现前述公开的服务器时间校准方法的步骤。A processor, configured to execute the computer program to implement the steps of the previously disclosed server time calibration method.

第四方面,本申请公开了一种计算机可读存储介质,用于存储计算机程序;其中,所述计算机程序被处理器执行时实现前述公开的服务器时间校准方法的步骤。In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein when the computer program is executed by a processor, the steps of the previously disclosed server time calibration method are implemented.

由此可见,本申请公开了一种服务器时间校准方法,包括:当检测到服务器当前处于已上电且未启动的第一状态,则控制基板管理控制器读取所述服务器中预先配置的第一实时时钟的当前时间,并将所述第一实时时钟的当前时间设置为所述基板管理控制器的当前内核时间,以便所述服务器的日志系统在所述第一状态下基于所述基板管理控制器的当前内核时间进行日志记录;所述服务器中的非主板位置上设有为所述第一实时时钟供电的储能器件;当检测到所述服务器处于正在启动的第二状态,则获取服务器主板上的第二实时时钟的当前时间,并在所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间不一致时,基于所述第二实时时钟的当前时间对所述基板管理控制器的当前内核时间进行校准,以更新所述基板管理控制器的当前内核时间;将所述基板管理控制器的当前内核时间发送至所述第一实时时钟,以便利用所述基板管理控制器的当前内核时间对所述第一实时时钟的当前时间进行更新。由此可见,当服务器当前处于上电但是未启动的第一状态时,BMC无法与BIOS交互,相应的,无法从硬件中获取到有效的时间信息,所以,当处于第一状态时,直接控制BMC从服务器另外配置的第一实时时钟中获取时间信息作为当前时间,这样一来,即使服务器尚未开机,BMC也能获取到有效的时间信息作为当前内核时间,而非初始设定值。然后当服务器处于正在启动的第二状态时,BMC能够获取主板上的第二实时时钟的当前时间,然后比较第二实时时钟的当前时间与BMC的当前内核时间是否一致,若不一致,则将第二实时时钟的当前时间对BMC的当前内核时间进行校准,也即利用第二实时时钟的当前时间更新BMC的当前内核时间,这样一来,通过利用最新的第二实时时钟的当前时间对BMC的当前内核时间进行校准、更新,保证BMC的当前内核时间能够携带最新最准的系统时间。最后将校准后的BMC的当前内核时间再次发送到第一实时时钟,对第一实时时钟的当前时间进行更新,确认第一实时时钟与第二实时时钟的时间信息保持一致,进一步确保整个系统的时间信息同步,使整个服务器系统中的时间均保持最新且准确。It can be seen that the present application discloses a server time calibration method, which includes: when detecting that the server is currently in a first state of being powered on and not started, controlling the baseboard management controller to read the preconfigured first time in the server. The current time of a real-time clock, and the current time of the first real-time clock is set to the current kernel time of the baseboard management controller, so that the log system of the server is based on the baseboard management in the first state The current core time of the controller is logged; an energy storage device that powers the first real-time clock is provided at a non-mainboard position in the server; when it is detected that the server is in the second state of being started, the The current time of the second real-time clock on the server motherboard, and when the current time of the second real-time clock is inconsistent with the current core time of the baseboard management controller, based on the current time of the second real-time clock, the Calibrating the current core time of the baseboard management controller to update the current core time of the baseboard management controller; sending the current core time of the baseboard management controller to the first real-time clock to utilize the baseboard management controller The current core time of the controller updates the current time of the first real-time clock. It can be seen that when the server is currently in the first state of power-on but not started, the BMC cannot interact with the BIOS. Correspondingly, it cannot obtain valid time information from the hardware. Therefore, when it is in the first state, it directly controls BMC obtains time information from the first real-time clock configured separately on the server as the current time. In this way, even if the server has not been powered on, BMC can obtain valid time information as the current kernel time instead of the initial setting value. Then when the server is in the second state of starting, the BMC can obtain the current time of the second real-time clock on the motherboard, and then compare the current time of the second real-time clock with the current kernel time of the BMC. If they are inconsistent, the The current time of the second real-time clock is used to calibrate the current core time of the BMC, that is, the current time of the second real-time clock is used to update the current core time of the BMC. In this way, the current time of the second real-time clock is used to calibrate the BMC's current core time. The current core time is calibrated and updated to ensure that the BMC's current core time can carry the latest and most accurate system time. Finally, the calibrated BMC's current core time is sent to the first real-time clock again, and the current time of the first real-time clock is updated to confirm that the time information of the first real-time clock and the second real-time clock are consistent, further ensuring that the entire system Time information is synchronized to keep the time in the entire server system up-to-date and accurate.

附图说明Description of the drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are only These are embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on the provided drawings without exerting creative efforts.

图1为本申请公开的一种服务器时间校准方法流程图;Figure 1 is a flow chart of a server time calibration method disclosed in this application;

图2为本申请公开的一种具体的服务器时间校准方法流程图;Figure 2 is a flow chart of a specific server time calibration method disclosed in this application;

图3为本申请公开的另一种具体的服务器时间校准方法流程图;Figure 3 is a flow chart of another specific server time calibration method disclosed in this application;

图4为本申请公开的一种服务器系统时间同步过程的时间信息数据流图;Figure 4 is a time information data flow diagram of a server system time synchronization process disclosed in this application;

图5为本申请公开的一种服务器主板管理板双RTC设计的BMC离线自校准内核时间方法流程图;Figure 5 is a flow chart of the BMC offline self-calibration kernel time method of a server motherboard management board dual RTC design disclosed in this application;

图6为本申请公开的一种服务器时间校准装置结构图;Figure 6 is a structural diagram of a server time calibration device disclosed in this application;

图7为本申请公开的一种电子设备结构图。Figure 7 is a structural diagram of an electronic device disclosed in this application.

具体实施方式Detailed ways

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.

在目前广泛应用的技术环境下,服务器通常只配备一个实时时钟RTC设备,其主要职能是为BIOS提供服务。对于未接入互联网的服务器,当没有NTP服务可用时,BMC将只能依赖于与BIOS的时间同步来获取当前时间。而这种同步过程只在每次操作系统启动过程中进行。由于没有NTP服务的外部时间校准,只能依赖内部的RTC设备,这可能使得服务器时间并不总是与实际时间完全一致。在服务器未开机的状态下,虽然主板电源已经为BMC提供了启动能力,但由于BIOS还未进行初始化以及与BMC进行信息交互,此时的BMC并不能从硬件获取到任何有效的时间信息。因此,此段时间内,BMC上显示的时间并非真实的系统时间,只是一个初始设定值,没有实际的参考意义。In the current widely used technical environment, servers are usually equipped with only a real-time clock RTC device, whose main function is to provide services for the BIOS. For servers not connected to the Internet, when no NTP service is available, BMC will only rely on time synchronization with the BIOS to obtain the current time. This synchronization process is only performed during each operating system startup. Since there is no external time calibration of the NTP service, it can only rely on the internal RTC device, which may make the server time not always exactly consistent with the actual time. When the server is not powered on, although the motherboard power supply has provided the BMC with the startup capability, the BMC cannot obtain any valid time information from the hardware because the BIOS has not yet been initialized and interacted with the BMC. Therefore, during this period, the time displayed on the BMC is not the real system time, but is only an initial setting value and has no actual reference significance.

为此,本申请提供了一种服务器时间校准方案,能够对于未接入互联网的服务器,实现服务器处于不同状态时,其内部的BMC以及服务器内部其他部分的时间一致且准确。To this end, this application provides a server time calibration solution that can achieve consistent and accurate time for the internal BMC and other parts of the server when the server is in different states for servers that are not connected to the Internet.

参照图1所示,本发明实施例公开了一种服务器时间校准方法,包括:Referring to Figure 1, an embodiment of the present invention discloses a server time calibration method, which includes:

步骤S11:当检测到服务器当前处于已上电且未启动的第一状态,则控制基板管理控制器读取所述服务器中预先配置的第一实时时钟的当前时间,并将所述第一实时时钟的当前时间设置为所述基板管理控制器的当前内核时间,以便所述服务器的日志系统在所述第一状态下基于所述基板管理控制器的当前内核时间进行日志记录;所述服务器中的非主板位置上设有为所述第一实时时钟供电的储能器件。Step S11: When it is detected that the server is currently in the first state of being powered on and not started, control the baseboard management controller to read the current time of the first real-time clock preconfigured in the server, and set the first real-time clock to The current time of the clock is set to the current core time of the baseboard management controller, so that the log system of the server performs logging based on the current core time of the baseboard management controller in the first state; in the server An energy storage device that supplies power to the first real-time clock is disposed at a non-mainboard position.

本实施例中,当服务器开始上电时,基板管理控制器BMC便开始启动,此时不需要考虑服务器是否已经启动,只需服务器通电即可。因此,当服务器处于开始上电但是处于未启动的第一状态时,由于基板管理控制器BMC已启动完成,因此服务器控制基板管理控制器BMC去读取服务器中预先配置的第一实时时钟RTC1的当前时间T1,并将该第一实时时钟RTC1的当前时间T1设置为基板管理控制器BMC的当前内核时间,这样一来,当基板管理控制器的内核时间为准确的当前时间T1的情况下,服务器中的日志系统才能在存在有效的时间戳的情况下,日志系统成功准确记录系统运行过程中发生的各种操作和事件的对应时间,所述的操作和事件具体可以包括但不限于:系统启动、系统关机、系统故障、系统警告等。管理员可以通过检查这些事件日志来帮助发现和解决问题。In this embodiment, when the server starts to be powered on, the baseboard management controller BMC starts to start. At this time, there is no need to consider whether the server has been started, it only needs to be powered on. Therefore, when the server is in the first state of being powered on but not started, since the baseboard management controller BMC has been started, the server controls the baseboard management controller BMC to read the first real-time clock RTC1 preconfigured in the server. The current time T1 is set to the current time T1 of the first real-time clock RTC1 as the current core time of the baseboard management controller BMC. In this way, when the core time of the baseboard management controller is the accurate current time T1, Only when a valid timestamp exists can the log system in the server successfully and accurately record the corresponding times of various operations and events that occur during the operation of the system. The operations and events may include but are not limited to: System Startup, system shutdown, system failure, system warning, etc. Administrators can examine these event logs to help identify and resolve problems.

而现有技术中,当服务器处于上电且未启动的第一状态时,虽然主板电源已经为BMC提供了启动能力,但由于BIOS还未进行初始化以及与BMC进行信息交互,此时的BMC并不能从硬件获取到任何有效的时间信息。因此,此段时间内,BMC上显示的时间并非真实的系统时间,只是一个初始设定值。这样一来,如果服务器出现了问题,开发和运维人员通常会通过查看日志来追踪问题的来源。但是由于现有技术中的BMC的时间只是一个初始设定值,而非真实的当前内核时间,因此当日志中的时间信息如果不准确,那么管理可能无法确定问题发生的具体时间,这将对问题的定位和解决造成困难。而本发明通过从第一实时时钟RTC1中获取其当前时间T1作为BMC的当前内核时间。保证了当前内核时间是真实的系统时间,而非某一设定值,大大提升了日志系统进行日志记录的时间准确性。In the existing technology, when the server is in the first state of being powered on and not started, although the motherboard power supply has provided the BMC with the startup capability, the BMC at this time has not yet been initialized and information exchanged with the BMC. Unable to obtain any valid time information from the hardware. Therefore, during this period, the time displayed on the BMC is not the real system time, but an initial setting value. In this way, if there is a problem with the server, development and operation and maintenance personnel will usually track the source of the problem by looking at the logs. However, since the BMC time in the existing technology is only an initial setting value, rather than the real current kernel time, if the time information in the log is inaccurate, the management may not be able to determine the specific time when the problem occurred, which will be detrimental to Difficulties arise in locating and resolving problems. In the present invention, the current time T1 is obtained from the first real-time clock RTC1 as the current core time of the BMC. This ensures that the current kernel time is the real system time, rather than a set value, which greatly improves the time accuracy of the log system's logging.

需要注意的是,所述第一实时时钟和所述储能器件均设置于独立于所述服务器主板的目标电路板上。可以理解的是,第一实时时钟RTC1以及为第一实时时钟RTC1供电的供电电池需要设置在DC-SCM上,以下对DC-SCM称为管理板,这样一来,第一实时时钟RTC1有独立的供电电池,能够在服务器未启动时,依靠自身供电电池对第一实时时钟RTC进行供电活动,通过将第一实时时钟RTC1和为之供电的供电电池设置在管理板,而与服务器主板中存在的第二实时时钟RTC2分开的这一设计让管理板获得了一个独立于主板CMOS的服务器下电计时能力。在服务器下电后重新上电的情况下,由于拥有管理板独立的RTC模块,BMC仍然能够进行精准的时间跟踪和管理,增强了服务器整体的运行效率和稳定性。It should be noted that the first real-time clock and the energy storage device are both disposed on a target circuit board independent of the server motherboard. It can be understood that the first real-time clock RTC1 and the power supply battery that powers the first real-time clock RTC1 need to be set on the DC-SCM. Hereinafter, the DC-SCM is called the management board. In this way, the first real-time clock RTC1 has an independent The power supply battery can rely on its own power supply battery to provide power to the first real-time clock RTC when the server is not started. By setting the first real-time clock RTC1 and the power supply battery that powers it on the management board, it is related to the server motherboard. This design of separating the second real-time clock RTC2 allows the management board to obtain a server power-off timing capability independent of the motherboard CMOS. When the server is powered off and then powered on again, BMC can still perform accurate time tracking and management due to its independent RTC module on the management board, which enhances the overall operating efficiency and stability of the server.

BMC直接通过管理板的RTC1独立获取时间信息,无需依赖于操作系统或BIOS。这种方式增强了BMC的自主性,并减少了其对其他系统部件的依赖性。如果操作系统或BIOS出现问题,例如:宕机或崩溃,BMC仍然可以通过RTC1获取时间,这就为其提供了一个更为准确和可靠的时间源,有助于提高其任务执行的准确性。BMC independently obtains time information directly through the RTC1 of the management board without relying on the operating system or BIOS. This approach enhances the BMC's autonomy and reduces its dependence on other system components. If there is a problem with the operating system or BIOS, such as downtime or crash, BMC can still obtain the time through RTC1, which provides it with a more accurate and reliable time source, helping to improve the accuracy of its task execution.

步骤S12:当检测到所述服务器处于正在启动的第二状态,则获取服务器主板上的第二实时时钟的当前时间,并在所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间不一致时,基于所述第二实时时钟的当前时间对所述基板管理控制器的当前内核时间进行校准,以更新所述基板管理控制器的当前内核时间。Step S12: When it is detected that the server is in the second starting state, obtain the current time of the second real-time clock on the server motherboard, and compare the current time of the second real-time clock with the baseboard management controller's When the current core time is inconsistent, the current core time of the baseboard management controller is calibrated based on the current time of the second real-time clock to update the current core time of the baseboard management controller.

本实施例中,当所述服务器上电后,检测所述服务器是否处于正在启动的第二状态;若检测到所述服务器处于正在启动的第二状态,则控制基本输入输出系统进行启动初始化操作;当所述基本输入输出系统的启动初始化完成后,控制所述基本输入输出系统从服务器主板上的第二实时时钟中获取所述第二实时时钟的当前时间,并通过所述基本输入输出系统将包含所述第二实时时钟的当前时间的系统事件日志通过系统事件日志命令同步至所述基板管理控制器;通过所述基板管理控制器解析所述系统事件日志,以获取所述第二实时时钟的当前时间;检测所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间是否一致;若所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间不一致,则利用所述第二实时时钟的当前时间对所述基板管理控制器的当前内核时间进行校准,以更新所述基板管理控制器的当前内核时间。可以理解的是,当服务器上电后,若检测到服务器当前处于正在启动的第二状态,则此时基本输入输出系统BIOS开始启动初始化,BIOS启动初始化结束后,BIOS会从服务器主板的第二实时时钟RTC2中读取第二实时时钟RTC2的当前时间T2,然后,BIOS会将包含RTC2的当前时间T2的系统事件和内核时间更新指令作为的系统事件日志命令同步至BMC,此时BMC接收到该系统事件以及内核时间更新指令后,首先解析该系统事件,获取RTC2的当前时间T2,然后先检测第二实时时钟RTC2的当前时间T2与基板管理控制器BMC的当前内核时间是否一致,若检测结果不一致,则执行内核时间更新指令,利用解析获取的当前时间T2对BMC的当前内核时间进行覆盖,在这个过程中,BMC的任务是解析由BIOS发送过来的系统事件,并将解析获取的时间T2设定为BMC的当前内核时间。这一操作确保了BMC能携带最新和最准确的系统时间。如果在解析过程中出现冲突,例如:BMC的当前内核时间和BIOS发送的时间T2不一致,那么会优先采用BIOS的T2时间信息。这是因为BIOS的时间信息具有更高的优先级,它直接来自系统的基本输入输出系统,所提供的时间信息更为可靠和精准。可见,BIOS发送的时间信息的优先级高于BMC的时间信息。In this embodiment, after the server is powered on, it is detected whether the server is in the second state of starting; if it is detected that the server is in the second state of starting, the basic input and output system is controlled to perform a startup initialization operation. ; When the startup initialization of the basic input and output system is completed, control the basic input and output system to obtain the current time of the second real-time clock from the second real-time clock on the server motherboard, and pass the basic input and output system Synchronize the system event log including the current time of the second real-time clock to the baseboard management controller through a system event log command; parse the system event log through the baseboard management controller to obtain the second real-time The current time of the clock; detecting whether the current time of the second real-time clock is consistent with the current core time of the baseboard management controller; if the current time of the second real-time clock is consistent with the current core time of the baseboard management controller If they are inconsistent, use the current time of the second real-time clock to calibrate the current core time of the baseboard management controller to update the current core time of the baseboard management controller. It can be understood that after the server is powered on, if it is detected that the server is currently in the second state of starting, the basic input and output system BIOS will start initialization at this time. After the BIOS startup initialization is completed, the BIOS will start from the second state of the server motherboard. Read the current time T2 of the second real-time clock RTC2 from the real-time clock RTC2. Then, the BIOS will synchronize the system event log containing the current time T2 of RTC2 and the kernel time update command to the BMC. At this time, the BMC receives After the system event and the kernel time update instruction, the system event is first parsed to obtain the current time T2 of RTC2, and then the current time T2 of the second real-time clock RTC2 is first detected to see whether it is consistent with the current core time of the baseboard management controller BMC. If detected If the results are inconsistent, execute the kernel time update command and use the current time T2 obtained by analysis to overwrite the current kernel time of BMC. In this process, the task of BMC is to parse the system events sent by the BIOS and parse the obtained time. T2 is set to the current core time of the BMC. This operation ensures that the BMC carries the latest and most accurate system time. If a conflict occurs during the parsing process, for example, the current kernel time of the BMC is inconsistent with the time T2 sent by the BIOS, the T2 time information of the BIOS will be used first. This is because the time information of the BIOS has a higher priority. It comes directly from the basic input and output system of the system, and the time information provided is more reliable and accurate. It can be seen that the time information sent by the BIOS has a higher priority than the time information sent by the BMC.

本实施例中,所述检测所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间是否一致之后,还包括:若所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间一致,则选择不对所述基板管理控制器的当前内核时间进行校准处理,以保持所述基板管理控制器的当前内核时间不变。可以理解的是,在检测BMC检测第二实时时钟RTC2的当前时间T2与基板管理控制器BMC的当前内核时间是否一致之后,如果检测结果为二者一致,则无需执行内核时间更新指令,保持基板管理控制器BMC的当前内核时间不变。In this embodiment, after detecting whether the current time of the second real-time clock is consistent with the current core time of the baseboard management controller, the method further includes: if the current time of the second real-time clock is consistent with the baseboard management controller If the current core time of the controller is consistent, it is selected not to calibrate the current core time of the baseboard management controller to keep the current core time of the baseboard management controller unchanged. It can be understood that after detecting whether the current time T2 of the second real-time clock RTC2 of the BMC is consistent with the current core time of the baseboard management controller BMC, if the detection result is that the two are consistent, there is no need to execute the core time update instruction and keep the baseboard The current core time of the management controller BMC remains unchanged.

步骤S13:将所述基板管理控制器的当前内核时间发送至所述第一实时时钟,以便利用所述基板管理控制器的当前内核时间对所述第一实时时钟的当前时间进行更新。Step S13: Send the current core time of the baseboard management controller to the first real-time clock, so as to update the current time of the first real-time clock using the current core time of the baseboard management controller.

本实施例中,在基板管理控制器BMC的当前内核时间更新之后,将更新后的BMC的当前内核时间发送至管理板的第一实时时钟RTC1中,以便利用当前内核时间对第一实时时钟RTC1的T1进行更新,实际上等同于将BIOS的时间信息T2直接写入到管理板RTC1中,可以看作是服务器上电后对管理板RTC1时间的首次更新操作。确认了管理板第一实时时钟RTC1与服务器BIOS中的时间信息保持一致,进一步确保整个系统的时间信息同步。In this embodiment, after the current core time of the baseboard management controller BMC is updated, the updated current core time of the BMC is sent to the first real-time clock RTC1 of the management board, so that the current core time can be used to update the first real-time clock RTC1 Updating T1 is actually equivalent to writing the BIOS time information T2 directly into the management board RTC1. It can be regarded as the first update operation of the management board RTC1 time after the server is powered on. It was confirmed that the first real-time clock RTC1 of the management board is consistent with the time information in the server BIOS, further ensuring that the time information of the entire system is synchronized.

由此可见,本申请公开了一种服务器时间校准方法,包括:当检测到服务器当前处于已上电且未启动的第一状态,则控制基板管理控制器读取所述服务器中预先配置的第一实时时钟的当前时间,并将所述第一实时时钟的当前时间设置为所述基板管理控制器的当前内核时间,以便所述服务器的日志系统在所述第一状态下基于所述基板管理控制器的当前内核时间进行日志记录;所述服务器中的非主板位置上设有为所述第一实时时钟供电的储能器件;当检测到所述服务器处于正在启动的第二状态,则获取服务器主板上的第二实时时钟的当前时间,并在所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间不一致时,基于所述第二实时时钟的当前时间对所述基板管理控制器的当前内核时间进行校准,以更新所述基板管理控制器的当前内核时间;将所述基板管理控制器的当前内核时间发送至所述第一实时时钟,以便利用所述基板管理控制器的当前内核时间对所述第一实时时钟的当前时间进行更新。由此可见,当服务器当前处于上电但是未启动的第一状态时,BMC无法与BIOS交互,相应的,无法从硬件中获取到有效的时间信息,所以,当处于第一状态时,直接控制BMC从服务器另外配置的第一实时时钟中获取时间信息作为当前时间,这样一来,即使服务器尚未开机,BMC也能获取到有效的时间信息作为当前内核时间,而非初始设定值。然后当服务器处于正在启动的第二状态时,BMC能够获取主板上的第二实时时钟的当前时间,然后比较第二实时时钟的当前时间与BMC的当前内核时间是否一致,若不一致,则将第二实时时钟的当前时间对BMC的当前内核时间进行校准,也即利用第二实时时钟的当前时间更新BMC的当前内核时间,这样一来,通过利用最新的第二实时时钟的当前时间对BMC的当前内核时间进行校准、更新,保证BMC的当前内核时间能够携带最新最准的系统时间。最后将校准后的BMC的当前内核时间再次发送到第一实时时钟,对第一实时时钟的当前时间进行更新,确认第一实时时钟与第二实时时钟的时间信息保持一致,进一步确保整个系统的时间信息同步,使整个服务器系统中的时间均保持最新且准确。It can be seen that the present application discloses a server time calibration method, which includes: when detecting that the server is currently in a first state of being powered on and not started, controlling the baseboard management controller to read the preconfigured first time in the server. The current time of a real-time clock, and the current time of the first real-time clock is set to the current kernel time of the baseboard management controller, so that the log system of the server is based on the baseboard management in the first state The current core time of the controller is logged; an energy storage device that powers the first real-time clock is provided at a non-mainboard position in the server; when it is detected that the server is in the second state of being started, the The current time of the second real-time clock on the server motherboard, and when the current time of the second real-time clock is inconsistent with the current core time of the baseboard management controller, based on the current time of the second real-time clock, the Calibrating the current core time of the baseboard management controller to update the current core time of the baseboard management controller; sending the current core time of the baseboard management controller to the first real-time clock to utilize the baseboard management controller The current core time of the controller updates the current time of the first real-time clock. It can be seen that when the server is currently in the first state of power-on but not started, the BMC cannot interact with the BIOS. Correspondingly, it cannot obtain valid time information from the hardware. Therefore, when it is in the first state, it directly controls BMC obtains time information from the first real-time clock configured separately on the server as the current time. In this way, even if the server has not been powered on, BMC can obtain valid time information as the current kernel time instead of the initial setting value. Then when the server is in the second state of starting, the BMC can obtain the current time of the second real-time clock on the motherboard, and then compare the current time of the second real-time clock with the current kernel time of the BMC. If they are inconsistent, the The current time of the second real-time clock is used to calibrate the current core time of the BMC, that is, the current time of the second real-time clock is used to update the current core time of the BMC. In this way, the current time of the second real-time clock is used to calibrate the BMC's current core time. The current core time is calibrated and updated to ensure that the BMC's current core time can carry the latest and most accurate system time. Finally, the calibrated BMC's current core time is sent to the first real-time clock again, and the current time of the first real-time clock is updated to confirm that the time information of the first real-time clock and the second real-time clock are consistent, further ensuring that the entire system Time information is synchronized to keep the time in the entire server system up-to-date and accurate.

参照图2所示,本发明实施例公开了一种具体的服务器时间校准方法,相对于上一实施例,本实施例对技术方案作了进一步的说明和优化。具体的:Referring to FIG. 2 , an embodiment of the present invention discloses a specific server time calibration method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. specific:

步骤S21:当检测到服务器当前处于已上电且未启动的第一状态,则控制基板管理控制器读取所述服务器中预先配置的第一实时时钟的当前时间,并将所述第一实时时钟的当前时间设置为所述基板管理控制器的当前内核时间,以便所述服务器的日志系统在所述第一状态下基于所述基板管理控制器的当前内核时间进行日志记录;所述服务器中的非主板位置上设有为所述第一实时时钟供电的储能器件。Step S21: When it is detected that the server is currently in the first state of being powered on and not started, control the baseboard management controller to read the current time of the first real-time clock preconfigured in the server, and set the first real-time clock to The current time of the clock is set to the current core time of the baseboard management controller, so that the log system of the server performs logging based on the current core time of the baseboard management controller in the first state; in the server An energy storage device that supplies power to the first real-time clock is disposed at a non-mainboard position.

步骤S22:当检测到所述服务器处于正在启动的第二状态,则获取服务器主板上的第二实时时钟的当前时间,并在所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间不一致时,基于所述第二实时时钟的当前时间对所述基板管理控制器的当前内核时间进行校准,以更新所述基板管理控制器的当前内核时间。Step S22: When it is detected that the server is in the second starting state, obtain the current time of the second real-time clock on the server motherboard, and compare the current time of the second real-time clock with the baseboard management controller When the current core time is inconsistent, the current core time of the baseboard management controller is calibrated based on the current time of the second real-time clock to update the current core time of the baseboard management controller.

其中,步骤S21、S22中更加详细的处理过程请参照前述公开的实施例内容,在此不再进行赘述。For more detailed processing procedures in steps S21 and S22, please refer to the previously disclosed embodiments and will not be described again here.

步骤S23:检测所述服务器当前是否处于已开机的第三状态;若当检测到所述服务器当前处于已开机的第三状态,则控制所述基板管理控制器发送所述基板管理控制器的当前内核时间至所述第一实时时钟,以便所述第一实时时钟利用所述当前内核时间对所述第一实时时钟的当前时间进行更新。Step S23: Detect whether the server is currently in a third state of being powered on; if it is detected that the server is currently in a third state of being powered on, control the baseboard management controller to send the current state of the baseboard management controller. kernel time to the first real-time clock, so that the first real-time clock uses the current kernel time to update the current time of the first real-time clock.

本实施例中,当服务器当前是否处于已开机的第三状态,若已经为已开机状态,且BIOS的同步信息已完成,那么相应的控制所述基板管理控制器并通过所述集成电路总线接口将所述基板管理控制器的当前内核时间写入所述第一实时时钟。可以理解的是,BMC与管理板的时间信息交互是通过集成电路总线接口IIC(Inter-Integrated Circuit)进行时间信息的交互,所述时间信息的交互,具体包括:控制基板管理控制器通过集成电路总线接口读取所述服务器中预先配置的第一实时时钟的当前时间;控制所述基板管理控制器并通过所述集成电路总线接口将所述基板管理控制器的当前内核时间写入所述第一实时时钟。也即,BMC从管理板的第一实时时钟RTC1中读取当前时间T1以及BMC向管理板的第一实时时钟RTC1写入当前内核时间至第一实时时钟所对应的CMOS内存中,这样一来,BMC通过IIC写入当前内核时间,以更新第一实时时钟RTC1中的当前时间T1。In this embodiment, when the server is currently in the third state of being powered on, if it is already in the powered on state and the synchronization information of the BIOS has been completed, then the baseboard management controller is controlled accordingly and the integrated circuit bus interface is used. Writing the current core time of the baseboard management controller to the first real-time clock. It can be understood that the time information interaction between the BMC and the management board is through the integrated circuit bus interface IIC (Inter-Integrated Circuit). The interaction of time information specifically includes: controlling the baseboard management controller through the integrated circuit The bus interface reads the current time of the first real-time clock preconfigured in the server; controls the baseboard management controller and writes the current core time of the baseboard management controller into the third through the integrated circuit bus interface. A real-time clock. That is, the BMC reads the current time T1 from the first real-time clock RTC1 of the management board and the BMC writes the current kernel time to the first real-time clock RTC1 of the management board into the CMOS memory corresponding to the first real-time clock. In this way , BMC writes the current core time through IIC to update the current time T1 in the first real-time clock RTC1.

由此可见,如果服务器处于开机的第三状态,并且BIOS的同步信息完成即BIOSpost complete,此时BMC内核时间根据前文描述一定与BIOS时间一致。此后BMC会将内核时间通过IIC接口写入管理板RTC1芯片,执行管理板RTC1时间更新操作。此外,BMC通过IIC接口读写管理板上的RTC芯片的时间信息。从RTC芯片读取的时间信息将被直接用作BMC内核的时间。这样一来,即使服务器尚未开机,BMC也可以获取到精准的时间信息。最后,BMC通过本发明可以在任何时间段获取到可靠有效的时间,能够为日志系统提供准确的时间戳,从而帮助开发和运维人员更有效地进行问题分析和定位。It can be seen that if the server is in the third power-on state and the BIOS synchronization information is completed, that is, BIOSpost complete, the BMC kernel time must be consistent with the BIOS time according to the previous description. After that, the BMC will write the kernel time to the management board RTC1 chip through the IIC interface and perform the management board RTC1 time update operation. In addition, the BMC reads and writes the time information of the RTC chip on the management board through the IIC interface. The time information read from the RTC chip will be directly used as the time of the BMC core. In this way, BMC can obtain accurate time information even if the server is not powered on yet. Finally, BMC can obtain reliable and effective time in any time period through the present invention, and can provide accurate timestamps for the log system, thereby helping development and operation and maintenance personnel analyze and locate problems more effectively.

参照图3所示,本发明实施例还公开了所述利用所述基板管理控制器的当前内核时间对所述第一实时时钟的当前时间进行更新之后,还包括:Referring to FIG. 3 , an embodiment of the present invention also discloses that after updating the current time of the first real-time clock using the current core time of the baseboard management controller, the method further includes:

步骤S31:设置时间同步任务。Step S31: Set time synchronization task.

本实施例中,设定一个时间同步任务,称之为TimeSync_Task。该时间同步任务的主要职责是定时地将BMC的当前内核时间通过IIC接口写入管理板RTC1芯片,也就是定时执行“System-To-Rtc1”。In this embodiment, a time synchronization task is set, called TimeSync_Task. The main responsibility of this time synchronization task is to regularly write the current core time of the BMC to the management board RTC1 chip through the IIC interface, that is, to execute "System-To-Rtc1" regularly.

步骤S32:定时触发所述时间同步任务,以依次按照第二实时时钟的时间、基本输入输出系统的时间、基板管理控制器的时间和第一实时时钟的时间的同步更新优先级顺序执行时间同步更新操作。Step S32: Trigger the time synchronization task regularly to perform time synchronization in sequence according to the synchronization update priority order of the time of the second real-time clock, the time of the basic input and output system, the time of the baseboard management controller and the time of the first real-time clock. Update operation.

本实施例中,定时触发时间同步任务,当执行任一次时间同步任务时,即触发时间同步操作,其中,整个系统的时间同步遵循一个优先级规则,即主板RTC2时间>BIOS时间>BMC内核时间>管理板RTC1时间,时间信息数据流如图4所示。从优先级上来看,高优先级源有权从逻辑上覆盖低优先级的时间信息。其中,图4的时间信息数据流在一次时间同步任务中的流向具体为:首先,服务器上电时,BMC从管理板的RTC1中获取当前时间T1作为BMC的当前内核时间,当服务器启动时,BMC立即通过初始化后的BIOS获取服务器主板的第二实时时钟RTC2的T2,也即,BIOS发送的SEL(System Event Log,系统事件日志)时间同步指令至BMC,以便BMC通过解析获取T2,进一步对BMC的当前内核时间进行校准,然后利用校准的BMC的当前内核时间更新管理板RTC1的当前时间,也即服务器下电后的首次更新,最后设置时间同步任务,基于BMC中的内核时间对系统中的管理板RTC1的时间定时更新。In this embodiment, the time synchronization task is triggered regularly. When any time synchronization task is executed, the time synchronization operation is triggered. The time synchronization of the entire system follows a priority rule, that is, motherboard RTC2 time > BIOS time > BMC core time. >Management board RTC1 time, time information data flow is shown in Figure 4. From a priority perspective, high-priority sources have the right to logically overwrite low-priority time information. Among them, the flow direction of the time information data flow in Figure 4 in a time synchronization task is as follows: first, when the server is powered on, the BMC obtains the current time T1 from the RTC1 of the management board as the current core time of the BMC. When the server starts, BMC immediately obtains T2 of the second real-time clock RTC2 of the server motherboard through the initialized BIOS, that is, the SEL (System Event Log, system event log) time synchronization instruction sent by BIOS to BMC, so that BMC can obtain T2 through analysis and further Calibrate the current core time of the BMC, and then use the calibrated current core time of the BMC to update the current time of the management board RTC1, which is the first update after the server is powered off. Finally, set up a time synchronization task to update the system based on the kernel time in the BMC. The time of the management board RTC1 is updated regularly.

这样的设计能够维持服务器全系统的时间同步,确保整个系统的正常、高效运行,同时也提升了系统的稳定性。这一机制在保证时间同步的同时,也实现了时序的准确性与系统运行的效率。This design can maintain the time synchronization of the entire server system, ensure the normal and efficient operation of the entire system, and also improve the stability of the system. This mechanism not only ensures time synchronization, but also achieves timing accuracy and system operation efficiency.

由此可见,通过增加了BIOS时间、BMC时间、管理板RTC1的定时同步。确立一个稳定、准确的时间同步机制,可以最大程度地避免由于时间误差带来的问题,提升服务器的效能和可靠性。使得BMC作为基板管理控制器的角色得到了加强,它可以更好地进行服务器的监控、警报和控制,从而提高整个服务器系统的稳定性和效率。It can be seen that the timing synchronization of BIOS time, BMC time, and management board RTC1 has been added. Establishing a stable and accurate time synchronization mechanism can avoid problems caused by time errors to the greatest extent and improve the performance and reliability of the server. The role of BMC as a baseboard management controller has been strengthened. It can better monitor, alarm and control servers, thereby improving the stability and efficiency of the entire server system.

参照图5所示,本发明实施例还公开了一种服务器主板管理板双RTC设计的BMC离线自校准内核时间方法,具体的:Referring to Figure 5, the embodiment of the present invention also discloses a BMC offline self-calibration kernel time method designed with dual RTCs on the server motherboard management board. Specifically:

主板拥有的RTC2是一个进一步设计的主板CMOS,它通过主板电池进行供电,并能够保存BIOS时间等重要数据。此外,管理板添加独立的RTC1和供电电池。这一设计让管理板获得了一个独立于主板CMOS的服务器下电计时能力。The RTC2 owned by the motherboard is a further designed motherboard CMOS, which is powered by the motherboard battery and can save important data such as BIOS time. In addition, the management board adds independent RTC1 and power supply battery. This design allows the management board to gain a server power-off timing capability that is independent of the motherboard CMOS.

在服务器上电但尚未启动的阶段,此时的BIOS尚未开始初始化过程,因此还没有向BMC发送时间同步的信息。在这个阶段,BMC执行“Rtc1-to-System”,通过IIC接口来读取管理板上的RTC1的时间信息T1,RTC1芯片读取的时间信息将被直接用作BMC内核的时间。这样,即使服务器尚未开机,BMC也可以获取到精准的时间信息。When the server is powered on but has not yet started, the BIOS has not yet started the initialization process, so time synchronization information has not yet been sent to the BMC. At this stage, BMC executes "Rtc1-to-System" and reads the time information T1 of RTC1 on the management board through the IIC interface. The time information read by the RTC1 chip will be directly used as the time of the BMC core. In this way, BMC can obtain accurate time information even if the server is not powered on yet.

在服务器启动过程中,当BIOS完成初始化之后,它将从主板的RTC2,也即CMOS中获取时间信息T2。然后,这个时间信息T2将通过SEL时间同步命令被同步到BMC。During the server startup process, when the BIOS completes initialization, it will obtain the time information T2 from the motherboard's RTC2, that is, CMOS. Then, this time information T2 will be synchronized to the BMC through the SEL time synchronization command.

在这个过程中,BMC的任务是解析由BIOS发送过来的SEL时间信息,并将这个时间设定为BMC的当前内核时间。这一操作确保了BMC能携带最新和最准确的系统时间。如果在解析过程中出现冲突,例如:BMC内核时间和BIOS发送的时间不一致,那么会优先采用BIOS的时间信息。这是因为BIOS的时间信息具有更高的优先级,它直接来自系统的基本输入输出系统,所提供的时间信息更为可靠和精准。In this process, the BMC's task is to parse the SEL time information sent by the BIOS and set this time as the current kernel time of the BMC. This operation ensures that the BMC carries the latest and most accurate system time. If a conflict occurs during the parsing process, for example, the BMC kernel time is inconsistent with the time sent by the BIOS, the BIOS time information will be used first. This is because the time information of the BIOS has a higher priority. It comes directly from the basic input and output system of the system, and the time information provided is more reliable and accurate.

如果服务器处于开机状态,并且BIOS的同步信息完成,也即BIOS post complete,那么BMC执行“System-To-Rtc1”,将BMC的当前内核时间通过IIC接口写入管理板RTC1芯片。从逻辑上讲,这实际上等同于将BIOS的时间信息直接写入到管理板RTC1,可以看作是服务器上电后对管理板RTC1时间的首次更新操作。这样做的目的是确认管理板RTC芯片与服务器BIOS中的时间信息保持一致,进一步确保整个系统的时间信息同步。If the server is powered on and the BIOS synchronization information is completed, that is, BIOS post complete, then the BMC executes "System-To-Rtc1" and writes the BMC's current core time to the management board RTC1 chip through the IIC interface. Logically speaking, this is actually equivalent to writing the BIOS time information directly to the management board RTC1. It can be regarded as the first update operation of the management board RTC1 time after the server is powered on. The purpose of this is to confirm that the time information in the management board RTC chip is consistent with the server BIOS, and further ensure that the time information of the entire system is synchronized.

设定一个定时时间同步任务,称之为TimeSync_Task。这个任务的主要职责是定时地将BMC的当前内核时间通过IIC接口写入管理板RTC1芯片,也就是定时执行“System-to-Rtc1”,执行一次时间同步操作。整个系统的时间同步遵循一个优先级规则,即主板RTC时间>BIOS时间>BMC内核时间>管理板RTC时间。从优先级上来看,高优先级源有权逻辑上覆盖低优先级的时间信息。这样的设计能够维持服务器全系统的时间同步,确保整个系统的正常、高效运行,同时也提升了系统的稳定性。这一机制在保证时间同步的同时,也实现了时序的准确性与系统运行的效率。Set up a scheduled time synchronization task, called TimeSync_Task. The main responsibility of this task is to regularly write the current core time of the BMC to the management board RTC1 chip through the IIC interface, that is, to execute "System-to-Rtc1" regularly and perform a time synchronization operation. The time synchronization of the entire system follows a priority rule, that is, motherboard RTC time > BIOS time > BMC kernel time > management board RTC time. From a priority perspective, high-priority sources have the right to logically overwrite low-priority time information. This design can maintain the time synchronization of the entire server system, ensure the normal and efficient operation of the entire system, and also improve the stability of the system. This mechanism not only ensures time synchronization, but also achieves timing accuracy and system operation efficiency.

参照图6所示,本发明实施例还公开了一种服务器时间校准装置,包括:Referring to Figure 6, an embodiment of the present invention also discloses a server time calibration device, which includes:

第一时间获取模块11,用于当检测到服务器当前处于已上电且未启动的第一状态,则控制基板管理控制器读取所述服务器中预先配置的第一实时时钟的当前时间,并将所述第一实时时钟的当前时间设置为所述基板管理控制器的当前内核时间,以便所述服务器的日志系统在所述第一状态下基于所述基板管理控制器的当前内核时间进行日志记录;所述服务器中的非主板位置上设有为所述第一实时时钟供电的储能器件;The first time acquisition module 11 is configured to, when detecting that the server is currently in the first state of being powered on and not started, control the baseboard management controller to read the current time of the first real-time clock preconfigured in the server, and Set the current time of the first real-time clock to the current core time of the baseboard management controller, so that the log system of the server performs logging based on the current core time of the baseboard management controller in the first state Record; an energy storage device that supplies power to the first real-time clock is provided at a non-mainboard position in the server;

时间校准模块12,用于当检测到所述服务器处于正在启动的第二状态,则获取服务器主板上的第二实时时钟的当前时间,并在所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间不一致时,基于所述第二实时时钟的当前时间对所述基板管理控制器的当前内核时间进行校准,以更新所述基板管理控制器的当前内核时间;The time calibration module 12 is configured to obtain the current time of the second real-time clock on the server motherboard when it is detected that the server is in the second state of starting, and compare the current time of the second real-time clock with the substrate. When the current core time of the management controller is inconsistent, calibrate the current core time of the baseboard management controller based on the current time of the second real-time clock to update the current core time of the baseboard management controller;

第一时间更新模块13,用于将所述基板管理控制器的当前内核时间发送至所述第一实时时钟,以便利用所述基板管理控制器的当前内核时间对所述第一实时时钟的当前时间进行更新。The first time update module 13 is configured to send the current core time of the baseboard management controller to the first real-time clock, so as to use the current core time of the baseboard management controller to update the current core time of the first real-time clock. time to update.

由此可见,本申请公开了当检测到服务器当前处于已上电且未启动的第一状态,则控制基板管理控制器读取所述服务器中预先配置的第一实时时钟的当前时间,并将所述第一实时时钟的当前时间设置为所述基板管理控制器的当前内核时间,以便所述服务器的日志系统在所述第一状态下基于所述基板管理控制器的当前内核时间进行日志记录;所述服务器中的非主板位置上设有为所述第一实时时钟供电的储能器件;当检测到所述服务器处于正在启动的第二状态,则获取服务器主板上的第二实时时钟的当前时间,并在所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间不一致时,基于所述第二实时时钟的当前时间对所述基板管理控制器的当前内核时间进行校准,以更新所述基板管理控制器的当前内核时间;将所述基板管理控制器的当前内核时间发送至所述第一实时时钟,以便利用所述基板管理控制器的当前内核时间对所述第一实时时钟的当前时间进行更新。由此可见,当服务器当前处于上电但是未启动的第一状态时,BMC无法与BIOS交互,相应的,无法从硬件中获取到有效的时间信息,所以,当处于第一状态时,直接控制BMC从服务器另外配置的第一实时时钟中获取时间信息作为当前时间,这样一来,即使服务器尚未开机,BMC也能获取到有效的时间信息作为当前内核时间,而非初始设定值。然后当服务器处于正在启动的第二状态时,BMC能够获取主板上的第二实时时钟的当前时间,然后比较第二实时时钟的当前时间与BMC的当前内核时间是否一致,若不一致,则将第二实时时钟的当前时间对BMC的当前内核时间进行校准,也即利用第二实时时钟的当前时间更新BMC的当前内核时间,这样一来,通过利用最新的第二实时时钟的当前时间对BMC的当前内核时间进行校准、更新,保证BMC的当前内核时间能够携带最新最准的系统时间。最后将校准后的BMC的当前内核时间再次发送到第一实时时钟,对第一实时时钟的当前时间进行更新,确认第一实时时钟与第二实时时钟的时间信息保持一致,进一步确保整个系统的时间信息同步,使整个服务器系统中的时间均保持最新且准确。It can be seen that this application discloses that when it is detected that the server is currently in the first state of being powered on and not started, the baseboard management controller reads the current time of the first real-time clock preconfigured in the server, and sets The current time of the first real-time clock is set to the current core time of the baseboard management controller, so that the log system of the server performs logging based on the current core time of the baseboard management controller in the first state. ; The non-mainboard position in the server is provided with an energy storage device that supplies power to the first real-time clock; when it is detected that the server is in the second state of being started, the second real-time clock on the server mainboard is obtained. The current time, and when the current time of the second real-time clock is inconsistent with the current core time of the baseboard management controller, the current core time of the baseboard management controller is calculated based on the current time of the second real-time clock. Calibrating to update the current core time of the baseboard management controller; sending the current core time of the baseboard management controller to the first real-time clock, so as to utilize the current core time of the baseboard management controller to update the baseboard management controller. The current time of the first real-time clock is updated. It can be seen that when the server is currently in the first state of power-on but not started, the BMC cannot interact with the BIOS. Correspondingly, it cannot obtain valid time information from the hardware. Therefore, when it is in the first state, it directly controls BMC obtains time information from the first real-time clock configured separately on the server as the current time. In this way, even if the server has not been powered on, BMC can obtain valid time information as the current kernel time instead of the initial setting value. Then when the server is in the second state of starting, the BMC can obtain the current time of the second real-time clock on the motherboard, and then compare the current time of the second real-time clock with the current kernel time of the BMC. If they are inconsistent, the The current time of the second real-time clock is used to calibrate the current core time of the BMC, that is, the current time of the second real-time clock is used to update the current core time of the BMC. In this way, the current time of the second real-time clock is used to calibrate the BMC's current core time. The current core time is calibrated and updated to ensure that the BMC's current core time can carry the latest and most accurate system time. Finally, the calibrated BMC's current core time is sent to the first real-time clock again, and the current time of the first real-time clock is updated to confirm that the time information of the first real-time clock and the second real-time clock are consistent, further ensuring that the entire system Time information is synchronized to keep the time in the entire server system up-to-date and accurate.

在一些具体实施方式中,所述时间校准模块12,具体可以包括:In some specific implementations, the time calibration module 12 may include:

第一状态检测单元,用于当所述服务器上电后,检测所述服务器是否处于正在启动的第二状态;A first state detection unit, configured to detect whether the server is in the second state of being started after the server is powered on;

初始化单元,用于若检测到所述服务器处于正在启动的第二状态,则控制基本输入输出系统进行启动初始化操作;An initialization unit, configured to control the basic input and output system to perform a startup initialization operation if it is detected that the server is in the second state of being started;

命令发送单元,用于当所述基本输入输出系统的启动初始化完成后,控制所述基本输入输出系统从服务器主板上的第二实时时钟中获取所述第二实时时钟的当前时间,并通过所述基本输入输出系统将包含所述第二实时时钟的当前时间的系统事件日志通过系统事件日志命令同步至所述基板管理控制器;A command sending unit, configured to control the basic input and output system to obtain the current time of the second real-time clock from the second real-time clock on the server motherboard after the startup initialization of the basic input-output system is completed, and pass the The basic input and output system synchronizes a system event log containing the current time of the second real-time clock to the baseboard management controller through a system event log command;

日志解析单元,用于通过所述基板管理控制器解析所述系统事件日志,以获取所述第二实时时钟的当前时间;A log parsing unit configured to parse the system event log through the baseboard management controller to obtain the current time of the second real-time clock;

时间检测单元,用于检测所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间是否一致;A time detection unit configured to detect whether the current time of the second real-time clock is consistent with the current core time of the baseboard management controller;

第一时间校准单元,用于若所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间不一致,则利用所述第二实时时钟的当前时间对所述基板管理控制器的当前内核时间进行校准,以更新所述基板管理控制器的当前内核时间。A first time calibration unit configured to use the current time of the second real-time clock to calibrate the current time of the baseboard management controller if the current time of the second real-time clock is inconsistent with the current core time of the baseboard management controller. The current core time is calibrated to update the current core time of the baseboard management controller.

在一些具体实施方式中,所述服务器时间校准装置,具体可以包括:In some specific implementations, the server time calibration device may specifically include:

第二时间校准单元,用于若所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间一致,则选择不对所述基板管理控制器的当前内核时间进行校准处理,以保持所述基板管理控制器的当前内核时间不变。A second time calibration unit configured to select not to calibrate the current core time of the baseboard management controller if the current time of the second real-time clock is consistent with the current core time of the baseboard management controller to maintain The current core time of the baseboard management controller remains unchanged.

在一些具体实施方式中,所述第一时间更新模块13,具体可以包括:In some specific implementations, the first time update module 13 may specifically include:

第二状态检测单元,用于检测所述服务器当前是否处于已开机的第三状态;a second state detection unit, configured to detect whether the server is currently in a third state of being powered on;

时间更新单元,用于若当检测到所述服务器当前处于已开机的第三状态,则控制所述基板管理控制器发送所述基板管理控制器的当前内核时间至所述第一实时时钟,以便所述第一实时时钟利用所述当前内核时间对所述第一实时时钟的当前时间进行更新。A time update unit configured to, if it is detected that the server is currently in a third state of being powered on, control the baseboard management controller to send the current core time of the baseboard management controller to the first real-time clock, so that The first real-time clock uses the current kernel time to update the current time of the first real-time clock.

在一些具体实施方式中,所述第一时间获取模块11,具体可以包括:In some specific implementations, the first time acquisition module 11 may specifically include:

时间读取单元,用于控制基板管理控制器通过集成电路总线接口读取所述服务器中预先配置的第一实时时钟的当前时间;A time reading unit configured to control the baseboard management controller to read the current time of the first real-time clock preconfigured in the server through the integrated circuit bus interface;

在一些具体实施方式中,所述第一时间更新模块13,具体可以包括:In some specific implementations, the first time update module 13 may specifically include:

时间写入单元,用于控制所述基板管理控制器并通过所述集成电路总线接口将所述基板管理控制器的当前内核时间写入所述第一实时时钟。A time writing unit is used to control the baseboard management controller and write the current core time of the baseboard management controller into the first real-time clock through the integrated circuit bus interface.

在一些具体实施方式中,所述服务器时间校准装置,具体可以包括:In some specific implementations, the server time calibration device may specifically include:

任务设置单元,用于设置时间同步任务;Task setting unit, used to set time synchronization tasks;

任务触发单元,用于定时触发所述时间同步任务,以依次按照所述第二实时时钟的时间、所述基本输入输出系统的时间、所述基板管理控制器的时间和所述第一实时时钟的时间的同步更新优先级顺序执行时间同步更新操作。A task triggering unit, configured to trigger the time synchronization task regularly to sequentially follow the time of the second real-time clock, the time of the basic input and output system, the time of the baseboard management controller and the first real-time clock. Time synchronization update operations are performed in the order of time synchronization update priority.

在一些具体实施方式中,所述服务器时间校准装置,具体可以包括:所述第一实时时钟和所述储能器件均设置于独立于所述服务器主板的目标电路板上。In some specific implementations, the server time calibration device may specifically include: the first real-time clock and the energy storage device are both disposed on a target circuit board independent of the server mainboard.

进一步的,本申请实施例还公开了一种电子设备,图7是根据一示例性实施例示出的电子设备20结构图,图中的内容不能认为是对本申请的使用范围的任何限制。Furthermore, the embodiment of the present application also discloses an electronic device. Figure 7 is a structural diagram of the electronic device 20 according to an exemplary embodiment. The content in the figure cannot be considered as any limitation on the scope of use of the present application.

图7为本申请实施例提供的一种电子设备20的结构示意图。该电子设备20,具体可以包括:至少一个处理器21、至少一个存储器22、电源23、通信接口24、输入输出接口25和通信总线26。其中,所述存储器22用于存储计算机程序,所述计算机程序由所述处理器21加载并执行,以实现前述任一实施例公开的服务器时间校准方法中的相关步骤。另外,本实施例中的电子设备20具体可以为电子计算机。FIG. 7 is a schematic structural diagram of an electronic device 20 provided by an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input-output interface 25 and a communication bus 26. The memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement relevant steps in the server time calibration method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

本实施例中,电源23用于为电子设备20上的各硬件设备提供工作电压;通信接口24能够为电子设备20创建与外界设备之间的数据传输通道,其所遵循的通信协议是能够适用于本申请技术方案的任意通信协议,在此不对其进行具体限定;输入输出接口25,用于获取外界输入数据或向外界输出数据,其具体的接口类型可以根据具体应用需要进行选取,在此不进行具体限定。In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be applicable Any communication protocol of the technical solution of this application is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the external world, and its specific interface type can be selected according to specific application needs. Here Not specifically limited.

其中,处理器21可以包括一个或多个处理核心,比如4核心处理器、8核心处理器等。处理器21可以采用DSP(Digital Signal Processing,数字信号处理)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)、PLA(Programmable Logic Array,可编程逻辑阵列)中的至少一种硬件形式来实现。处理器21也可以包括主处理器和协处理器,主处理器是用于对在唤醒状态下的数据进行处理的处理器,也称CPU(Central ProcessingUnit,中央处理器);协处理器是用于对在待机状态下的数据进行处理的低功耗处理器。在一些实施例中,处理器21可以在集成有GPU(Graphics Processing Unit,图像处理器),GPU用于负责显示屏所需要显示的内容的渲染和绘制。一些实施例中,处理器21还可以包括AI(Artificial Intelligence,人工智能)处理器,该AI处理器用于处理有关机器学习的计算操作。The processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can adopt at least one hardware form among DSP (Digital Signal Processing, digital signal processing), FPGA (Field-Programmable Gate Array, field programmable gate array), and PLA (Programmable Logic Array, programmable logic array). accomplish. The processor 21 may also include a main processor and a co-processor. The main processor is a processor used to process data in the wake-up state, also called CPU (Central Processing Unit, central processing unit); the co-processor is A low-power processor used to process data in standby mode. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit, image processor), and the GPU is responsible for rendering and drawing content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence, artificial intelligence) processor, which is used to process computing operations related to machine learning.

另外,存储器22作为资源存储的载体,可以是只读存储器、随机存储器、磁盘或者光盘等,其上所存储的资源可以包括操作系统221、计算机程序222等,存储方式可以是短暂存储或者永久存储。In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be short-term storage or permanent storage. .

其中,操作系统221用于管理与控制电子设备20上的各硬件设备以及计算机程序222,以实现处理器21对存储器22中海量数据223的运算与处理,其可以是Windows Server、Netware、Unix、Linux等。计算机程序222除了包括能够用于完成前述任一实施例公开的由电子设备20执行的服务器时间校准方法的计算机程序之外,还可以进一步包括能够用于完成其他特定工作的计算机程序。数据223除了可以包括电子设备接收到的由外部设备传输进来的数据,也可以包括由自身输入输出接口25采集到的数据等。Among them, the operating system 221 is used to manage and control each hardware device and the computer program 222 on the electronic device 20 to realize the calculation and processing of the massive data 223 in the memory 22 by the processor 21. It can be Windows Server, Netware, Unix, Linux etc. In addition to computer programs that can be used to complete the server time calibration method executed by the electronic device 20 disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs that can be used to complete other specific tasks. In addition to data received by the electronic device and transmitted from an external device, the data 223 may also include data collected by its own input and output interface 25, etc.

进一步的,本申请还公开了一种计算机可读存储介质,用于存储计算机程序;其中,所述计算机程序被处理器执行时实现前述公开的服务器时间校准方法。关于该方法的具体步骤可以参考前述实施例中公开的相应内容,在此不再进行赘述。Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein when the computer program is executed by a processor, the previously disclosed server time calibration method is implemented. Regarding the specific steps of this method, reference may be made to the corresponding content disclosed in the foregoing embodiments, which will not be described again here.

本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。Each embodiment in this specification is described in a progressive manner. Each embodiment focuses on its differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple. For relevant details, please refer to the description in the method section.

专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器RAM(Random Access Memory)、内存、只读存储器ROM(Read Only Memory)、电可编程EPROM(Electrically Programmable Read Only Memory)、电可擦除可编程EEPROM(ElectricErasable Programmable Read Only Memory)、寄存器、硬盘、可移动磁盘、CD-ROM(CompactDisc-Read Only Memory,紧凑型光盘只读储存器)、或技术领域内所公知的任意其它形式的存储介质中。Those skilled in the art may further realize that the units and algorithm steps of each example described in connection with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. In order to clearly illustrate the possible functions of hardware and software, Interchangeability, in the above description, the composition and steps of each example have been generally described according to functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each specific application, but such implementations should not be considered beyond the scope of this application. The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly in hardware, in software modules executed by a processor, or in a combination of both. Software modules can be placed in RAM (Random Access Memory), memory, ROM (Read Only Memory), electrically programmable EPROM (Electrically Programmable Read Only Memory), electrically erasable programmable EEPROM (ElectricErasable Programmable Read Only Memory), register, hard disk, removable disk, CD-ROM (Compact Disc-Read Only Memory), or any other form of storage medium known in the technical field.

最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。Finally, it should be noted that in this article, 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 these entities or any such actual relationship or sequence between operations. Furthermore, the terms "comprises," "comprises," or any other variations thereof are intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus that includes a list of elements includes not only those elements, but also those not expressly listed other elements, or elements inherent to the process, method, article or equipment. Without further limitation, an element defined by the statement "comprises a..." does not exclude the presence of additional identical elements in a process, method, article, or apparatus that includes the stated element.

以上对本发明所提供的一种服务器时间校准方法、装置、设备及介质进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The server time calibration method, device, equipment and medium provided by the present invention have been introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for assistance. Understand the method of the present invention and its core idea; at the same time, for those of ordinary skill in the field, there will be changes in the specific implementation and application scope based on the idea of the present invention. In summary, the content of this specification does not It should be understood as a limitation of the invention.

Claims (10)

1.一种服务器时间校准方法,其特征在于,包括:1. A server time calibration method, characterized by including: 当检测到服务器当前处于已上电且未启动的第一状态,则控制基板管理控制器读取所述服务器中预先配置的第一实时时钟的当前时间,并将所述第一实时时钟的当前时间设置为所述基板管理控制器的当前内核时间,以便所述服务器的日志系统在所述第一状态下基于所述基板管理控制器的当前内核时间进行日志记录;所述服务器中的非主板位置上设有为所述第一实时时钟供电的储能器件;When it is detected that the server is currently in the first state of being powered on and not started, the baseboard management controller reads the current time of the first real-time clock preconfigured in the server, and sets the current time of the first real-time clock to The time is set to the current core time of the baseboard management controller, so that the log system of the server performs logging based on the current core time of the baseboard management controller in the first state; the non-mainboard in the server An energy storage device is provided at the position to power the first real-time clock; 当检测到所述服务器处于正在启动的第二状态,则获取服务器主板上的第二实时时钟的当前时间,并在所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间不一致时,基于所述第二实时时钟的当前时间对所述基板管理控制器的当前内核时间进行校准,以更新所述基板管理控制器的当前内核时间;When it is detected that the server is in the second state of starting, the current time of the second real-time clock on the server motherboard is obtained, and the current time of the second real-time clock is compared with the current core time of the baseboard management controller. When inconsistent, calibrating the current core time of the baseboard management controller based on the current time of the second real-time clock to update the current core time of the baseboard management controller; 将所述基板管理控制器的当前内核时间发送至所述第一实时时钟,以便利用所述基板管理控制器的当前内核时间对所述第一实时时钟的当前时间进行更新。The current core time of the baseboard management controller is sent to the first real-time clock, so that the current time of the first real-time clock is updated with the current core time of the baseboard management controller. 2.根据权利要求1所述的服务器时间校准方法,其特征在于,所述当检测到所述服务器处于正在启动的第二状态,则获取服务器主板上的第二实时时钟的当前时间,并在所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间不一致时,基于所述第二实时时钟的当前时间对所述基板管理控制器的当前内核时间进行校准,以更新所述基板管理控制器的当前内核时间,包括:2. The server time calibration method according to claim 1, characterized in that when it is detected that the server is in the second state of being started, the current time of the second real-time clock on the server motherboard is obtained, and When the current time of the second real-time clock is inconsistent with the current core time of the baseboard management controller, the current core time of the baseboard management controller is calibrated based on the current time of the second real-time clock to update the current core time of the baseboard management controller. Describes the current core time of the baseboard management controller, including: 当所述服务器上电后,检测所述服务器是否处于正在启动的第二状态;After the server is powered on, detect whether the server is in the second state of starting; 若检测到所述服务器处于正在启动的第二状态,则控制基本输入输出系统进行启动初始化操作;If it is detected that the server is in the second state of starting, then control the basic input and output system to perform a startup initialization operation; 当所述基本输入输出系统的启动初始化完成后,控制所述基本输入输出系统从服务器主板上的第二实时时钟中获取所述第二实时时钟的当前时间,并通过所述基本输入输出系统将包含所述第二实时时钟的当前时间的系统事件日志通过系统事件日志命令同步至所述基板管理控制器;After the startup initialization of the basic input and output system is completed, the basic input and output system is controlled to obtain the current time of the second real-time clock from the second real-time clock on the server motherboard, and use the basic input and output system to obtain the current time of the second real-time clock. Synchronizing a system event log containing the current time of the second real-time clock to the baseboard management controller through a system event log command; 通过所述基板管理控制器解析所述系统事件日志,以获取所述第二实时时钟的当前时间;Parse the system event log through the baseboard management controller to obtain the current time of the second real-time clock; 检测所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间是否一致;Detect whether the current time of the second real-time clock is consistent with the current core time of the baseboard management controller; 若所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间不一致,则利用所述第二实时时钟的当前时间对所述基板管理控制器的当前内核时间进行校准,以更新所述基板管理控制器的当前内核时间。If the current time of the second real-time clock is inconsistent with the current core time of the baseboard management controller, use the current time of the second real-time clock to calibrate the current core time of the baseboard management controller to update The current core time of the baseboard management controller. 3.根据权利要求2所述的服务器时间校准方法,其特征在于,所述检测所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间是否一致之后,还包括:3. The server time calibration method according to claim 2, wherein after detecting whether the current time of the second real-time clock is consistent with the current core time of the baseboard management controller, it further includes: 若所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间一致,则选择不对所述基板管理控制器的当前内核时间进行校准处理,以保持所述基板管理控制器的当前内核时间不变。If the current time of the second real-time clock is consistent with the current core time of the baseboard management controller, then choose not to calibrate the current core time of the baseboard management controller to maintain the current core time of the baseboard management controller. Kernel time remains unchanged. 4.根据权利要求2所述的服务器时间校准方法,其特征在于,所述将所述基板管理控制器的当前内核时间发送至所述第一实时时钟,以便利用所述基板管理控制器的当前内核时间对所述第一实时时钟的当前时间进行更新,包括:4. The server time calibration method according to claim 2, characterized in that the current kernel time of the baseboard management controller is sent to the first real-time clock in order to utilize the current core time of the baseboard management controller. The kernel time updates the current time of the first real-time clock, including: 检测所述服务器当前是否处于已开机的第三状态;Detect whether the server is currently in a third state of being powered on; 若当检测到所述服务器当前处于已开机的第三状态,则控制所述基板管理控制器发送所述基板管理控制器的当前内核时间至所述第一实时时钟,以便所述第一实时时钟利用所述当前内核时间对所述第一实时时钟的当前时间进行更新。If it is detected that the server is currently in a third state of being powered on, the baseboard management controller is controlled to send the current core time of the baseboard management controller to the first real-time clock, so that the first real-time clock The current time of the first real-time clock is updated using the current kernel time. 5.根据权利要求4所述的服务器时间校准方法,其特征在于,所述控制基板管理控制器读取所述服务器中预先配置的第一实时时钟的当前时间,包括:5. The server time calibration method according to claim 4, wherein the control substrate management controller reads the current time of the first real-time clock preconfigured in the server, including: 控制基板管理控制器通过集成电路总线接口读取所述服务器中预先配置的第一实时时钟的当前时间;Control the baseboard management controller to read the current time of the first real-time clock preconfigured in the server through the integrated circuit bus interface; 相应的,所述控制所述基板管理控制器发送所述基板管理控制器的当前内核时间至所述第一实时时钟,包括:Correspondingly, controlling the baseboard management controller to send the current core time of the baseboard management controller to the first real-time clock includes: 控制所述基板管理控制器并通过所述集成电路总线接口将所述基板管理控制器的当前内核时间写入所述第一实时时钟。Control the baseboard management controller and write the current core time of the baseboard management controller into the first real-time clock through the integrated circuit bus interface. 6.根据权利要求1至5任一项所述的服务器时间校准方法,其特征在于,还包括:6. The server time calibration method according to any one of claims 1 to 5, further comprising: 设置时间同步任务;Set time synchronization tasks; 定时触发所述时间同步任务,以依次按照所述第二实时时钟的时间、所述基本输入输出系统的时间、所述基板管理控制器的时间和所述第一实时时钟的时间的同步更新优先级顺序执行时间同步更新操作。The time synchronization task is triggered regularly to prioritize synchronization updates based on the time of the second real-time clock, the time of the basic input and output system, the time of the baseboard management controller, and the time of the first real-time clock. Time synchronization update operations are performed sequentially. 7.根据权利要求1所述的服务器时间校准方法,其特征在于,所述第一实时时钟和所述储能器件均设置于独立于所述服务器主板的目标电路板上。7. The server time calibration method according to claim 1, wherein the first real-time clock and the energy storage device are both disposed on a target circuit board independent of the server mainboard. 8.一种服务器时间校准装置,其特征在于,包括:8. A server time calibration device, characterized in that it includes: 第一时间获取模块,用于当检测到服务器当前处于已上电且未启动的第一状态,则控制基板管理控制器读取所述服务器中预先配置的第一实时时钟的当前时间,并将所述第一实时时钟的当前时间设置为所述基板管理控制器的当前内核时间,以便所述服务器的日志系统在所述第一状态下基于所述基板管理控制器的当前内核时间进行日志记录;所述服务器中的非主板位置上设有为所述第一实时时钟供电的储能器件;A first time acquisition module, configured to, when detecting that the server is currently in a first state of being powered on and not started, control the baseboard management controller to read the current time of the first real-time clock preconfigured in the server, and The current time of the first real-time clock is set to the current core time of the baseboard management controller, so that the log system of the server performs logging based on the current core time of the baseboard management controller in the first state. ; An energy storage device that supplies power to the first real-time clock is provided at a non-mainboard position in the server; 时间校准模块,用于当检测到所述服务器处于正在启动的第二状态,则获取服务器主板上的第二实时时钟的当前时间,并在所述第二实时时钟的当前时间与所述基板管理控制器的当前内核时间不一致时,基于所述第二实时时钟的当前时间对所述基板管理控制器的当前内核时间进行校准,以更新所述基板管理控制器的当前内核时间;A time calibration module, configured to obtain the current time of the second real-time clock on the server motherboard when it is detected that the server is in the second state of starting, and compare the current time of the second real-time clock with the baseboard management When the current core time of the controller is inconsistent, calibrate the current core time of the baseboard management controller based on the current time of the second real-time clock to update the current core time of the baseboard management controller; 第一时间更新模块,用于将所述基板管理控制器的当前内核时间发送至所述第一实时时钟,以便利用所述基板管理控制器的当前内核时间对所述第一实时时钟的当前时间进行更新。A first time update module configured to send the current core time of the baseboard management controller to the first real-time clock, so as to use the current core time of the baseboard management controller to update the current time of the first real-time clock. Make an update. 9.一种电子设备,其特征在于,包括:9. An electronic device, characterized in that it includes: 存储器,用于保存计算机程序;Memory, used to hold computer programs; 处理器,用于执行所述计算机程序,以实现如权利要求1至7任一项所述的服务器时间校准方法的步骤。A processor, configured to execute the computer program to implement the steps of the server time calibration method according to any one of claims 1 to 7. 10.一种计算机可读存储介质,其特征在于,用于存储计算机程序;其中,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述的服务器时间校准方法的步骤。10. A computer-readable storage medium, characterized in that it is used to store a computer program; wherein when the computer program is executed by a processor, the steps of the server time calibration method according to any one of claims 1 to 7 are implemented. .
CN202311104189.4A 2023-08-30 2023-08-30 Method, device, equipment and medium for calibrating server time Pending CN117148918A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311104189.4A CN117148918A (en) 2023-08-30 2023-08-30 Method, device, equipment and medium for calibrating server time

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311104189.4A CN117148918A (en) 2023-08-30 2023-08-30 Method, device, equipment and medium for calibrating server time

Publications (1)

Publication Number Publication Date
CN117148918A true CN117148918A (en) 2023-12-01

Family

ID=88903863

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311104189.4A Pending CN117148918A (en) 2023-08-30 2023-08-30 Method, device, equipment and medium for calibrating server time

Country Status (1)

Country Link
CN (1) CN117148918A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119128953A (en) * 2024-11-14 2024-12-13 苏州元脑智能科技有限公司 A data processing method, device, medium and program product
CN119892287A (en) * 2025-03-28 2025-04-25 苏州元脑智能科技有限公司 Time synchronization method, device, management controller, medium and product
CN120276552A (en) * 2025-06-06 2025-07-08 苏州元脑智能科技有限公司 Time synchronization method, device, system, network equipment and storage medium
CN120335550A (en) * 2025-06-17 2025-07-18 苏州元脑智能科技有限公司 Electronic device, clock calibration method, storage medium and program product

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119128953A (en) * 2024-11-14 2024-12-13 苏州元脑智能科技有限公司 A data processing method, device, medium and program product
CN119892287A (en) * 2025-03-28 2025-04-25 苏州元脑智能科技有限公司 Time synchronization method, device, management controller, medium and product
CN120276552A (en) * 2025-06-06 2025-07-08 苏州元脑智能科技有限公司 Time synchronization method, device, system, network equipment and storage medium
CN120335550A (en) * 2025-06-17 2025-07-18 苏州元脑智能科技有限公司 Electronic device, clock calibration method, storage medium and program product

Similar Documents

Publication Publication Date Title
CN117148918A (en) Method, device, equipment and medium for calibrating server time
US10013332B2 (en) Monitoring mobile application performance
US7197657B1 (en) BMC-hosted real-time clock and non-volatile RAM replacement
US10102170B2 (en) System and method for providing input/output functionality by an I/O complex switch
US10303458B2 (en) Multi-platform installer
CN111221800B (en) Database migration method and device, electronic equipment and storage medium
CN113656147A (en) A cluster deployment method, apparatus, device and storage medium
US20110231641A1 (en) Information-processing apparatus and method of starting information-processing apparatus
US10955872B2 (en) System and method to retain baseboard management controller real-time clock time during BMC reboot
CN113126694A (en) Time synchronization method, system, equipment and storage medium of computer management subsystem
CN119336668B (en) Network card management method and device
CN115794182A (en) Firmware out-of-band upgrade method, device, electronic equipment and storage medium
CN119225784B (en) Firmware updating method, computer device, storage medium, and program product
US12019466B2 (en) Virtual precision time protocol clock devices for virtual nodes
CN113377156A (en) RTC (real time clock) accuracy verification method and device
CN118748576A (en) Log timestamp correction method, device and computer-readable storage medium
CN110417619A (en) A method, system and storage medium for recording abnormal state of a server
US7401156B2 (en) Method using control interface to suspend software network environment running on network devices for loading and executing another software network environment
JP5722990B2 (en) Computer system, computer time management method
US12223355B2 (en) Synchronization of system resources in a multi-socket data processing system
CN115987760B (en) Service process guarding method and dual-machine service system in dual-machine mode
CN118535372A (en) Soft fault location method, device and equipment based on baseboard management controller
US12001675B1 (en) Method and apparatus for supporting control windows
CN120276552A (en) Time synchronization method, device, system, network equipment and storage medium
CN118826937A (en) Time synchronization method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination