Module for managing timezone on Windows systems.
salt.modules.win_timezone.
TzMapper
(unix_to_win)¶add
(k, v)¶get_unix
(key, default=None)¶get_win
(key, default=None)¶list_unix
()¶list_win
()¶remove
(k)¶salt.modules.win_timezone.
get_hwclock
()¶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
salt.modules.win_timezone.
get_offset
()¶Get current numeric timezone offset from UTC (i.e. -0700)
Offset from UTC
CLI Example:
salt '*' timezone.get_offset
salt.modules.win_timezone.
get_zone
()¶Get current timezone (i.e. America/Denver)
Timezone in unix format
CLI Example:
salt '*' timezone.get_zone
salt.modules.win_timezone.
get_zonecode
()¶Get current timezone (i.e. PST, MDT, etc)
An abbreviated timezone code
CLI Example:
salt '*' timezone.get_zonecode
salt.modules.win_timezone.
list
(unix_style=True)¶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
salt.modules.win_timezone.
set_hwclock
(clock)¶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
salt.modules.win_timezone.
set_zone
(timezone)¶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'
salt.modules.win_timezone.
zone_compare
(timezone)¶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'