MikroTik API icon

MikroTik API

Community Node for MikroTik RouterOS API

Actions67

System Clock → Get Clock

AI-generated

Summary

Retrieve the current system clock from the MikroTik device.

Inputs

  • connectionAttempts — Number of times to try connecting to the device
  • connectionDelay — Delay between attempts in seconds
  • cleanKeys — Replace - and / with _ in response keys
  • tag — Custom tag appended as .tag=${tag} to the API call

Output shape

Clock data including date, time, and time-zone-name. Returned as a JSON array with count and data fields; keys may have hyphens and slashes replaced with underscores if cleanKeys is enabled.

Read-only operation; no side effects on the device.

Examples

Example 1: Fetch clock once with default options.

Leave all option fields at their defaults; the node issues /system/clock/print and returns the clock values.

Example 2: Fetch clock with retry logic and key cleaning.

Set connectionAttempts to 3, connectionDelay to 2, and cleanKeys to true; the node will retry up to 3 times with 2-second gaps, and any hyphens or slashes in response keys will be converted to underscores.

Links

Discussion