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)
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)
Returns: | Offset from UTC |
---|---|
Return type: | str |
CLI Example:
salt '*' timezone.get_offset
Get current timezone (i.e. America/Denver)
Returns: | Timezone in unix format |
---|---|
Return type: | str |
CLI Example:
salt '*' timezone.get_zone
Get current timezone (i.e. PST, MDT, etc)
Returns: | An abbreviated timezone code |
---|---|
Return type: | str |
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.
Parameters: |
unix_style (bool) -- True returns Unix-style timezones. False returns Windows-style timezones. Default is True
|
---|---|
Returns: | A list of supported timezones |
Return type: | list |
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.
Parameters: | timezone (str) -- A valid timezone |
---|---|
Returns: |
True if successful, otherwise False
|
Return type: | bool |
Raises: |
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.
Parameters: |
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 |
---|---|
Returns: |
True if they match, otherwise False
|
Return type: | bool |
Example:
salt '*' timezone.zone_compare 'America/Denver'
© 2019 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.win_timezone.html