Skip to content

v2.0.7

Latest

Choose a tag to compare

@eleonel eleonel released this 18 Feb 13:15
· 1 commit to main since this release

NTP Time Synchronization & Timezone Support

New Features

Built-in NTP Time Sync

  • Automatic time synchronization: Device syncs time via NTP (pool.ntp.org) automatically when WiFi connects — no external API dependency.
  • Reconnection support: NTP re-syncs automatically if WiFi disconnects and reconnects.
  • Configurable NTP server: Override the default server via system.ntp_server in webscreen.json.

Full Timezone Support

  • POSIX TZ strings: Device timezone is configured using standard POSIX TZ strings, supporting all global timezones with DST rules.
  • Three format modes: Accepts UTC, numeric offset (e.g. -3), or full POSIX TZ string (e.g. EST5EDT,M3.2.0,M11.1.0).
  • Admin tool timezone dropdown: New <select> dropdown with 400+ IANA timezones grouped by region (Africa, America, Asia, etc.), automatically mapped to POSIX TZ strings.
  • Auto-detect button: Detects the user's browser timezone and selects the matching entry.

JavaScript Time API

  • 9 new functions available in JavaScript applications: get_hours(), get_minutes(), get_seconds(), get_year(), get_month(), get_day(), get_weekday(), get_epoch(),
    ntp_synced().
  • No HTTP calls needed: Clock apps no longer depend on external time APIs.

Serial Commands

  • /time: Display current device time, epoch, and day of week.
  • /settime <epoch> [timezone]: Manually set time from epoch with optional POSIX TZ string.

Configuration

Add timezone to your webscreen.json:

json
{
"settings": {
"wifi": {
"ssid": "MyNetwork",
"pass": "MyPassword"
}
},
"display": {
"brightness": 200
},
"timezone": "EST5EDT,M3.2.0,M11.1.0",
"script": "app.js"
}

POSIX TZ String Examples:

┌──────────────┬────────────────────────────┐
│ Location │ POSIX TZ String │
├──────────────┼────────────────────────────┤
│ UTC │ UTC0 │
├──────────────┼────────────────────────────┤
│ US Eastern │ EST5EDT,M3.2.0,M11.1.0 │
├──────────────┼────────────────────────────┤
│ US Pacific │ PST8PDT,M3.2.0,M11.1.0 │
├──────────────┼────────────────────────────┤
│ Buenos Aires │ <-03>3 │
├──────────────┼────────────────────────────┤
│ Tokyo │ JST-9 │
├──────────────┼────────────────────────────┤
│ London │ GMT0BST,M3.5.0/1,M10.5.0 │
├──────────────┼────────────────────────────┤
│ Berlin │ CET-1CEST,M3.5.0,M10.5.0/3 │
└──────────────┴────────────────────────────┘

Full database: https://github.com/nayarsystems/posix_tz_db

JavaScript API Usage:

// Check if time is available
if (ntp_synced()) {
let h = get_hours();
let m = get_minutes();
let s = get_seconds();
print("Time: " + numberToString(h) + ":" + numberToString(m) + ":" + numberToString(s));

let year = get_year();
let month = get_month();
let day = get_day();
print("Date: " + numberToString(year) + "-" + numberToString(month) + "-" + numberToString(day));
}

Serial Command Usage:

WebScreen> /time
Current time: 2026-02-17 14:23:45
Epoch: 1771337025
Day of week: 2 (0=Sun)

WebScreen> /settime 1771337025 <-03>3
Time set: 2026-02-17 11:23:45

Full Changelog: 2.0.6...2.0.7