Skip to content

Command Line Tool

pschatzmann edited this page Nov 1, 2026 · 2 revisions

tinycts is the desktop counterpart of tinyntp (Linux, macOS and Windows). It is built on TinyCTSClient and TinyCTSServer.

Build

cmake -S tools/tinycts -B build-tinycts && cmake --build build-tinycts

(Windows: add --config Release.) Requirements:

  • Linux: BlueZ (the bluetooth service) and the development files of GLib (Debian/Ubuntu: libglib2.0-dev)
  • macOS: the Xcode command line tools. The tool embeds an Info.plist for the Bluetooth permission; the terminal may ask for it
  • Windows: Visual Studio (C++/WinRT)

Commands

tinycts [options] [device]     show the time of a device
tinycts scan [options]         list the devices in range
tinycts serve [options]        serve the time of this computer
tinycts set [options] device   set the time of a device
tinycts tz                     the time zone information of this computer
Option
-i <adapter> Bluetooth adapter (Linux only, default: hci0)
-t <ms> time to look for the device (default: 10000)
-n <seconds> serve: notify the subscribed clients every n seconds
-a <name> serve: name of the device (default: tinycts)
-z set: send also the time zone of this computer
--local the Current Time is the local time instead of UTC
-v show diagnostic messages (Linux)
-h help

The device is a Bluetooth address (AA:BB:CC:DD:EE:FF) or a name. Without it the first device in range that advertises the Current Time Service is used. Phones usually do not advertise it: use the address of the phone. macOS does not tell addresses: use the identifier that scan shows.

set writes the clock of this computer, corrected by the time the connection needs and half of the round trip time. If the device requires an encrypted connection, pair it first.

Example

$ tinycts AA:BB:CC:DD:EE:FF
device:        my-clock (AA:BB:CC:DD:EE:FF)
UTC:           2026-11-01 08:08:26.250
local:         2026-11-01 09:08:26.250 UTC+01:00
source:        NTP, accuracy 125 ms
clock offset:  +0.012 s (device - this computer)

Exit codes: 0 ok, 1 no device / no response, 2 usage error, 3 the device refused the time.

Clone this wiki locally