Module for managing timezone on Windows systems.
Get current hardware clock setting (UTC or localtime)
Note
The hardware clock is always local time on Windows so this will always return "localtime"
CLI Example:
salt '*' timezone.get_hwclock
Get current numeric timezone offset from UTC (i.e. -0700)
Offset from UTC
CLI Example:
salt '*' timezone.get_offset
Get current timezone (i.e. America/Denver)
Timezone in unix format
CommandExecutionError -- If timezone could not be gathered
CLI Example:
salt '*' timezone.get_zone
Get current timezone (i.e. PST, MDT, etc)
An abbreviated timezone code
CLI Example:
salt '*' timezone.get_zonecode
Return a list of Timezones that this module supports. These can be in either Unix or Windows format.
New in version 2018.3.3.
unix_style (bool) -- True
returns Unix-style timezones. False
returns
Windows-style timezones. Default is True
A list of supported timezones
CLI Example:
# Unix-style timezones
salt '*' timezone.list
# Windows-style timezones
salt '*' timezone.list unix_style=False
Sets the hardware clock to be either UTC or localtime
Note
The hardware clock is always local time on Windows so this will always
return False
CLI Example:
salt '*' timezone.set_hwclock UTC
Sets the timezone using the tzutil.
timezone (str) -- A valid timezone
True
if successful, otherwise False
CommandExecutionError -- If invalid timezone is passed
CLI Example:
salt '*' timezone.set_zone 'America/Denver'
Compares the given timezone with the machine timezone. Mostly useful for running state checks.
timezone (str) -- The timezone to compare. This can be in Windows or Unix format. Can
be any of the values returned by the timezone.list
function
True
if they match, otherwise False
Example:
salt '*' timezone.zone_compare 'America/Denver'