Module for editing date/time settings on macOS
New in version 2016.3.0.
Displays the current date
| Returns: | the system date |
|---|---|
| Return type: | str |
CLI Example:
salt '*' timezone.get_date
Get current hardware clock setting (UTC or localtime)
CLI Example:
salt '*' timezone.get_hwclock
Displays the current time zone offset
| Returns: | The current time zone offset |
|---|---|
| Return type: | str |
CLI Example:
salt '*' timezone.get_offset
Get the current system time.
| Returns: | The current time in 24 hour format |
|---|---|
| Return type: | str |
CLI Example:
salt '*' timezone.get_time
Display the currently set network time server.
| Returns: | the network time server |
|---|---|
| Return type: | str |
CLI Example:
salt '*' timezone.get_time_server
Display whether network time is on or off
| Returns: | True if network time is on, False if off |
|---|---|
| Return type: | bool |
CLI Example:
salt '*' timezone.get_using_network_time
Displays the current time zone
| Returns: | The current time zone |
|---|---|
| Return type: | str |
CLI Example:
salt '*' timezone.get_zone
Displays the current time zone abbreviated code
| Returns: | The current time zone code |
|---|---|
| Return type: | str |
CLI Example:
salt '*' timezone.get_zonecode
Displays a list of available time zones. Use this list when setting a time zone using timezone.set_zone
| Returns: | a list of time zones |
|---|---|
| Return type: | list |
CLI Example:
salt '*' timezone.list_zones
Set the current month, day, and year
| Parameters: |
date (str) -- The date to set. Valid date formats are:
|
|---|---|
| Returns: | True if successful, False if not |
| Return type: | bool |
| Raises: | SaltInvocationError on Invalid Date format |
| Raises: | CommandExecutionError on failure |
CLI Example:
salt '*' timezone.set_date 1/13/2016
Sets the hardware clock to be either UTC or localtime
CLI Example:
salt '*' timezone.set_hwclock UTC
Sets the current time. Must be in 24 hour format.
| Parameters: | time (str) -- The time to set in 24 hour format. The value must be double quoted. ie: '"17:46"' |
|---|---|
| Returns: | True if successful, False if not |
| Return type: | bool |
| Raises: | SaltInvocationError on Invalid Time format |
| Raises: | CommandExecutionError on failure |
CLI Example:
salt '*' timezone.set_time '"17:34"'
Designates a network time server. Enter the IP address or DNS name for the network time server.
| Parameters: | time_server -- IP or DNS name of the network time server. If nothing is passed the time server will be set to the macOS default of 'time.apple.com' |
|---|---|
| Type: | str |
| Returns: | True if successful, False if not |
| Return type: | bool |
| Raises: | CommandExecutionError on failure |
CLI Example:
salt '*' timezone.set_time_server time.acme.com
Set whether network time is on or off.
| Parameters: | enable -- True to enable, False to disable. Can also use 'on' or 'off' |
|---|---|
| Type: | str bool |
| Returns: | True if successful, False if not |
| Return type: | bool |
| Raises: | CommandExecutionError on failure |
CLI Example:
salt '*' timezone.set_using_network_time True
Set the local time zone. Use timezone.list_zones to list valid time_zone arguments
| Parameters: | time_zone (str) -- The time zone to apply |
|---|---|
| Returns: | True if successful, False if not |
| Return type: | bool |
| Raises: | SaltInvocationError on Invalid Timezone |
| Raises: | CommandExecutionError on failure |
CLI Example:
salt '*' timezone.set_zone America/Denver
Compares the given timezone name with the system timezone name.
| Returns: | True if they are the same, False if not |
|---|---|
| Return type: | bool |
CLI Example:
salt '*' timezone.zone_compare America/Boise
© 2019 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.mac_timezone.html