Keeps the clock right on Windows Mobile and Windows CE devices. ClockSync sets the clock from internet time servers automatically:
- at every boot, warm or cold, and
- whenever a network connection comes up (Wi-Fi, cradle, USB).
Many of these devices (the Zebra/Motorola MC55A among them) ship without any time service. They lose the date whenever the backup battery runs flat or the device is reset, and a wrong date breaks HTTPS: certificates look expired or not yet valid. ClockSync fixes that once, so you don't have to.
It's a small native program of about 18 KB, with no .NET and no other files needed. It uses the standard NTP protocol (SNTP, UDP port 123).
Tested on: Zebra MC55A, Windows Embedded Handheld 6.5.
Requires: Windows Mobile 6 / 6.1 / 6.5 (Windows CE 5.2) on ARM.
Choose one way:
- From App Store: pick ClockSync and tap Install. App Store downloads the latest release and runs ClockSync's install for you. Tap OK on ClockSync's message.
- With
AppStoreSetup.exe: the one-file setup for new devices installs ClockSync first, before .NET CF 3.5 and App Store, so the clock is right from the start. - By hand: copy
ClockSync.exe(from the latest release) to the device and tap it. It sets the clock, shows the result and asks whether to install. Answer Yes.
Installing does three things:
- It copies itself to
\Application\ClockSync\. On Zebra/Motorola devices that folder is flash storage, which survives a cold boot. - It adds boot shortcuts in
\Application\Startup(run by Motorola's startup process after a reset) and\Windows\StartUp. - It registers itself to run whenever the network connects. That registration doesn't survive a cold boot on its own, so ClockSync renews it at every boot.
Then it sets the clock straight away.
There's nothing to do day to day. To check on it:
- Tap
\Application\ClockSync\ClockSync.exe(or the Sync Clock shortcut App Store makes) to sync now and see the result. - Read the log:
\Application\ClockSync\ClockSync.log. At about 32 KB it's renamed toClockSync.old.logand a new one starts.
| Command | What it does |
|---|---|
ClockSync.exe |
Sync now and show the result; offers to install if it isn't installed. |
ClockSync.exe /install |
Install (see above), then sync. |
ClockSync.exe /uninstall |
Stop running at boot and on network connect. Leaves the files. |
ClockSync.exe /version |
Show the version. |
ClockSync.exe /boot |
What the boot shortcuts run: syncs silently, retrying while Wi-Fi comes up. |
When the network connects, Windows starts ClockSync with AppRunAtNetConnect.
It syncs silently, at most once every 10 minutes.
A wrong clock breaks HTTPS just as badly as a missing one, so ClockSync is careful about what it accepts:
- Replies must match the request. Each request carries a random value that the server has to echo back, and the reply must come from the address it was sent to. Stray, stale or spoofed packets are ignored.
- Unhealthy servers are rejected:
- servers that say they aren't synchronised (leap indicator "alarm", or a bad stratum);
- servers whose own error estimate is over 1 second;
- replies with a round trip over 5 seconds.
- Big jumps need a second opinion.
- A correction of more than an hour is applied only if a second server agrees to within 2 seconds.
- If only one server can be reached, the correction is still applied but
logged as "unconfirmed". Set
require_confirmation=1to forbid that.
- Small differences are left alone. The clock is only changed when it's more than 2 seconds off (adjustable).
- Polite to servers.
- A Kiss-o'-Death reply (RATE, DENY, RSTR) makes that server sit out for 24 hours.
- Network-triggered syncs run at most once every 10 minutes, even if Wi-Fi keeps dropping and reconnecting.
- Ready for 2036. The NTP time counter rolls over in 2036; that's handled, and dates decode correctly until 2104. Replies outside 2025–2104 are rejected as implausible.
- No hanging on slow DNS. Name lookups that hang, which is common for a few minutes after Wi-Fi connects, are abandoned after 4 seconds. ClockSync then uses the server's last known address, which it saves after every successful lookup.
\Application\ClockSync\ClockSync.ini is created when you install. Edit it to
use your own time servers: many company networks block public ones and run
their own. Installing again (or updating through App Store) keeps your edited
file.
# Time servers, tried in order (up to 8).
server=ntp.mycompany.local
server=time.nist.gov
server=pool.ntp.org
# Leave the clock alone if it's off by no more than this many seconds.
min_seconds=2
# Corrections larger than this need two servers to agree (at least 60).
confirm_over_seconds=3600
# 1 = never make a large correction from a single server.
require_confirmation=0
The defaults are time.nist.gov, pool.ntp.org, time.google.com and
time.windows.com, in that order.
| In the log | Meaning |
|---|---|
Clock corrected: it was … (…, confirmed by 2 servers) |
All good. |
…, unconfirmed: only one server answered |
Applied, but only one server could be reached. |
DNS lookup failed / DNS lookup timed out |
Usually Wi-Fi still coming up, which is normal right after boot. It keeps retrying for 5 minutes, and the network trigger catches the next connection. |
no reply from every server |
The network probably blocks UDP port 123. Add your company's NTP server to ClockSync.ini. |
Not changed: servers disagree … |
Two servers gave times more than 2 s apart for a large correction, so nothing was changed. Try other servers. |
Two more things to know:
- Log times before a correction are wrong. Log lines are stamped with the device clock, so lines written before a correction carry the old time.
- A worn backup battery is usually why these devices lose the time in the first place. Replacing it stops the clock resetting on every battery swap.
- Time servers give UTC. The local time follows the device's time-zone setting.
- At boot, ClockSync retries every 5 seconds for the first 2 minutes, then every 15 seconds, for up to 5 minutes while Wi-Fi comes up. After that, the network trigger catches the next connection.
- On-screen clocks update straight away: Windows CE's own time-change notification fires when the clock is set.
- ClockSync keeps a little state in the registry under
HKEY_LOCAL_MACHINE\Software\ClockSync: when the last sync succeeded, which servers are backed off, and their last known addresses.
| Limitation | Why |
|---|---|
| SNTP over UDP port 123 only | It's the standard way to get the time. An HTTPS-based fallback would need the clock to already be right for its certificate check. If your network blocks port 123, use an internal NTP server. |
| No authenticated NTP (NTS) | Hardly any public servers offer it, and it needs TLS. The safeguards above (random values, a second server for big jumps, sanity limits) guard against the realistic problems. |
| No gradual adjustment | Windows CE has no API for slowly speeding up or slowing down the clock, so ClockSync sets it directly. Small differences (2 s or less by default) are left alone. |
| Windows Mobile 6 and later | Built for Windows CE 5.2. |
| IPv4 only | These devices' networks are effectively IPv4-only. |
You need Visual Studio 2008 and the Windows Mobile 6 Professional SDK. Open
ClockSync.sln, build Release, and the result is
Windows Mobile 6 Professional SDK (ARMV4I)\Release\ClockSync.exe.
To publish a new version, bump CLOCKSYNC_VERSION in clocksync.c and release
it with a matching tag, for example v1.0.2. If you also build
AppStoreSetup.exe, update CLOCKSYNC_TAG in its Setup\resource.h.
GPLv3. See LICENSE.