Whether to allow setting time in NTP mode

George Liu liuxiwei1013 at gmail.com
Mon Sep 19 19:06:04 AEST 2022


Hey, everyone:

  This email would like to discuss whether to allow the requirement to
set the time when NTP is enabled.

  In the phosphor-time-manager, The current design logic is:
  1. The timeManager will listen to the TimeSyncMethod property of the
xyz.openbmc_project.Time.Synchronization interface to set the SetNTP
method of timedate1 and update the current Time mode. [1]
  2. When the user changes the time using OOB, the timeManager does
not verify the current Time mode, and directly calls the settime
method to change the time. If the current is in NTP mode, setting the
time will throw an exception. [2]

  But there is a potential problem here:
  When the user sets the mode from NTP to manual by way of OOB, then
the time is set immediately. At this time, there will be an error in
setting the time because the NTP service is not completely stopped,
but we do not want to throw this error to the user, because for the
user layer, the mode has been switched to manual (TimeSyncMethod =
Manual)[3]

  I have a patch that determines whether the current NTP service is
completely stopped (a timeout mechanism is added) when setting the
time [4]. But @Lei suggested that this mechanism should not be
implemented on the timeManager server side, but should be handled on
the client side.

  Also, @Lei also has a different idea downstream, using settimeofday
instead of timedate1

  I would like to hear everyone's suggestions, and I would like to
optimize this function if appropriate.

Thanks

[1]: https://github.com/openbmc/phosphor-time-manager/blob/master/manager.cpp#L28-L31
[2]: https://github.com/openbmc/phosphor-time-manager/blob/43dfeeb1e22d6d7fcec9f1d4be81f3e9d6857e62/bmc_epoch.cpp#L120-L139
[3]: https://github.com/openbmc/bmcweb/blob/07c8c20d371aae85611738ca61015fc6a8caa16a/redfish-core/lib/network_protocol.hpp#L215-L240
[4]: https://gerrit.openbmc.org/c/openbmc/phosphor-time-manager/+/56584


George Liu


More information about the openbmc mailing list