Skip to main content

Timezone

The timezone of the host. osapi behavior get --name timezone and osapi behavior method get show the same.

Behavior​

Nametimezone
DescriptionThe timezone of the host
Placementnode
Internalno
APIyes
CLIyes
Nextno
Platformslinux, darwin
Sudonone
Runsnone
Writesnone
Keeps stateno
Usesnone
Used bynone

Methods (2)​

NAMEVERBHTTPROUTEPERMISSIONDESCRIPTION
getreadGET/api/node/{hostname}/timezonetimezone:readGet the timezone of the host
updatewritePUT/api/node/{hostname}/timezonetimezone:writeSet the timezone of the host

Types (2)​

NAMEINPUTOUTPUT
getGetInputEntry { timezone, utc_offset }
updateUpdateInput { timezone* }Result { timezone, changed }

Settings (0)​

None. Declare them with behavior.Config.

Telemetry​

Spanbehavior.timezone.<method>
Child spansexec timedatectl
Metricsosapi_behavior_calls_total, osapi_behavior_duration_seconds, osapi_behavior_changes_total
Attributesosapi.behavior.name, osapi.behavior.method, osapi.behavior.verb, osapi.behavior.outcome, osapi.behavior.changed
Recorded inputstimezone (update)

Method get​

Nameget
Verbread
DescriptionGet the timezone of the host
DetailReads the IANA name of the timezone and its offset from UTC now: the zone that /etc/localtime links to, or /etc/timezone on Linux.
HTTPGET
Route/api/node/{hostname}/timezone
Permissiontimezone:read
Commandosapi client node timezone get
Input typeGetInput
Output typeEntry

Input (0)​

None. The method takes no input; its command needs only --target.

Output (2)​

FIELDTYPEDESCRIPTION
timezonestringThe IANA name of the timezone, such as America/New_York
utc_offsetstringThe offset from UTC now, such as -05:00

Examples (2)​

EXAMPLEINPUTOUTPUT
A Linux host on UTC(none)timezone=UTC, utc_offset=+00:00
A Mac on UTC(none)timezone=UTC, utc_offset=+00:00

Method update​

Nameupdate
Verbwrite
DescriptionSet the timezone of the host
DetailSets the timezone with timedatectl set-timezone. A host that already has the timezone does not change and reports changed: false. It runs on the Debian family only, and elsewhere reports skipped.
HTTPPUT
Route/api/node/{hostname}/timezone
Permissiontimezone:write
Commandosapi client node timezone update
Input typeUpdateInput
Output typeResult

Input (1)​

FIELDTYPEREQUIREDCONSTRAINTSDESCRIPTION
timezonestringyespattern ^[A-Za-z0-9_+][A-Za-z0-9_+-](/[A-Za-z0-9_+-]+)$, max length 64The IANA name of the timezone, such as UTC or America/New_York

Output (2)​

FIELDTYPEDESCRIPTION
timezonestringThe timezone of the host
changedbooleanWhether the host changed

Examples (2)​

EXAMPLEINPUTOUTPUT
Set a new timezonetimezone=America/New_Yorktimezone=America/New_York, changed=true
A host that already has the timezonetimezone=UTCtimezone=UTC, changed=false