Skip to content

Time synchronization via NTP (ntp_sync)

What it does: Sets the device's system time according to an NTP server over the Internet.

ntp_sync

Inputs

  • tz: time shift (timezone).

Output

  • none (command block).

When to use it

  • After connecting to Wi-Fi, when you need the exact current time.
  • Before logging timestamped data.

Tips and pitfalls

  • Synchronization will not take place without an active Wi-Fi connection.
  • NTP should be called at startup and then only occasionally for correction.

Generated Python example

set_ntp_time(1)