Querying and Changing the Host Time
The HostDateTimeSystem supports date and time related configuration on a host and supports both Network Time Protocol (NTP) and Precision Time Protocol (PTP) configuration.
The HostDateTimeSystem.dateTimeInfo property allows you to retrieve and set date and time information. The HostDateTimeInfo data object’s properties contain these data objects for date and time management:
- HostNTPConfig contains a list of NTP servers for use by the host.
HostPTPConfig
contains device and networking information.- HostDateTimeSystemTimeZone specifies the time zone including the GMT offset, identifier for the time zone, and name.
You can also query the host’s time information by calling one of the HostDateTimeSystem methods.
- QueryAvailableTimeZones – Retrieves the list of available timezones on the host. The method uses the public domain tz timezone database. The method returns an array of HostDateTimeSystemTimeZone objects.
- QueryDateTime – Returns the current date and time on the host.
You can modify the host’s date and time information by calling one of the following HostDateTimeSystem methods:
- RefreshDateTimeSystem – Refreshes the date and time related settings to pick up any changes that might have occurred.
- UpdateDateTime – Updates the date and time on the host using the date and time passed into the method. Use with caution. Network delays or execution delays can result in time skews.
- UpdateDateTimeConfig – Updates the date and time configuration of the host. You call this method with a HostDateTimeConfig parameter, which allows you to specify NTP configuration, PTP configuration, and the time zone.