14. Time settings
This section describes how to retrieve or configure time and date settings using supported BMC interfaces.
BMC can be configured to use two different time synchronization methods: NTP or manual.
If the time synchronization method is manual, the setting of date and time must be done manually using either CLI, REST or IPMI interface. If the time synchronization method is NTP, the setting og date and time is automatically synchronized using NTP protocol (using timesyncd service as NTP client) with the NTP servers that are either provided manually, or using the default systemd NTP servers. (timeX.google.com)
Note
Time zones are not currently supported by upstream OpenBMC. All times read from BMC are assumed to be in UTC.
14.1. BMC command line
To get the current date and time, the
date
comamnd can be used. Refer to linux man pages for details of this command.To get the current time synchronization method of BMC:
$ busctl get-property xyz.openbmc_project.Settings /xyz/openbmc_project/time/sync_method xyz.openbmc_project.Time.Synchronization TimeSyncMethod
To set the time synchronization method of BMC:
# Set BMC time synchronization method to NTP $ busctl set-property xyz.openbmc_project.Settings /xyz/openbmc_project/time/sync_method xyz.openbmc_project.Time.Synchronization TimeSyncMethod s "xyz.openbmc_project.Time.Synchronization.Method.NTP" # Set BMC time synchronization method to Manual $ busctl set-property xyz.openbmc_project.Settings /xyz/openbmc_project/time/sync_method xyz.openbmc_project.Time.Synchronization TimeSyncMethod s "xyz.openbmc_project.Time.Synchronization.Method.Manual"
To confirm that setting of time mode is applied, one can check the “NTP service” status of the output of the
timedatectl
command.$ timedatectl Local time: Sat 2021-06-19 16:14:23 UTC Universal time: Sat 2021-06-19 16:14:23 UTC RTC time: Sat 2021-06-19 16:14:24 Time zone: n/a (UTC, +0000) System clock synchronized: yes NTP service: active RTC in local TZ: no
If the “NTP service” field is reported as “active” then BMC timesyncd service is syncing time with either a configured NTP server or a default one.
To manually add NTP servers in CLI one can use below command:
$ busctl set-property xyz.openbmc_project.Network /xyz/openbmc_project/network/eth0 xyz.openbmc_project.Network.EthernetInterface NTPServers as 1 "<ntp_server>"
14.2. GUI
The time management operations available in the GUI are shown in Fig. 14.1.
Note
BMC is the only time owner of the system.
Note
If the BMC time synchronization method is NTP, then the first time you try to manually set the date and time from the GUI might fail. This is due the time it takes for the timesyncd service to be stopped on BMC and is described in https://github.com/openbmc/phosphor-time-manager#special-note-on-changing-ntp-setting. The second try should set the time and date correctly.

Fig. 14.1 GUI: time management operations
14.3. REST API
To get current time synchronization method of BMC use the following
curl
command:$ curl -k https://<bmcip>/xyz/openbmc_project/time/sync_method/attr/TimeSyncMethod -u <bmcuser>:<bmcpass>
To set time synchronization method of BMC use the following command:
# Set BMC time synchronization method to NTP $ curl -k -X PUT -d '{"data": "xyz.openbmc_project.Time.Synchronization.Method.NTP" }' https://<bmcip>/xyz/openbmc_project/time/sync_method/attr/TimeSyncMethod -u <bmcuser>:<bmcpass> # Set BMC time synchronization method to Manual $ curl -k -X PUT -d '{"data": "xyz.openbmc_project.Time.Synchronization.Method.Manual" }' https://<bmcip>/xyz/openbmc_project/time/sync_method/attr/TimeSyncMethod -u <bmcuser>:<bmcpass>
To manually add NTP servers in CLI one can use below command:
$ curl -k -X PUT -d '{"data": ["<ntp_server>"] }' https://<bmcip>/xyz/openbmc_project/network/eth0/attr/NTPServers
Note
It is possible to get the BMC time using REST interface using below command, however the time is returned as epoch time, that is microseconds after 1970:01:01.
$ curl -b cjar -k https://<bmcip>/xyz/openbmc_project/time/bmc
14.4. IPMI
Time synchronization mode setting is currently not supported over the IPMI interface. Assuming BMC is not in NTP mode, one can get or set time using the following IPMI commands:
# Set time and date $ ipmitool -I lanplus -U <user> -P <password> -H <hostip/hostname> sel time set "DD/MM/YYYY HH:MM:SS" # Get time and date $ ipmitool -I lanplus -U <user> -P <password> -H <hostip/hostname> sel time get
Note
Setting the time over IPMI interface if the BMC time synchronization method is NTP, will fail. Please use the CLI or REST interface to set the time synchronization method of BMC to Manual.
14.5. Redfish
Setting time and date of BMC is not currently supported.