Using SNTP time on Amiga
I never really cared too much about having correct time information available in my Amiga. Maybe not least to the fact that the battery backed-up real-time clocks on Amigas are usually not backed-up by a battery.
Getting started
Today, I got triggered to change that. Bubbob42, one of the AmigaOS 3.2 developers, mentioned that he relies on the sntp-client wrapped up in http://aminet.net/package/util/misc/UHCTools. That would certainly be good enough for me. After installing and reading the docs of the package and reading up on NTP (e.g. at https://www.pool.ntp.org/) again I discovered that “sntp server de.pool.ntp.org” would get me a correct date, but NOT my local time in Germany. I would just be behind by a few hours. Bummer!
Homing in
After scratching my head for a bit I checked up on the docs for the Amiga sntp-tool bundled up in UHCTools at http://aminet.net/package/comm/net/sntp. Turns out it needed an ENV-variable called TZONE and that I would have to set that to be happy.
From the SNTP-docs: “It will adjust for both timezone offset from UTC and daylight saving time using the TZONE env variable. [..] Unless you set TZONE manually or install AmigaOS4.1, you can use the following comprehensive list of utilities which maintains a TZONE env variable: http://aminet.net/package/util/time/SetDST“
After getting and running that, I got TZONE set to “CET-1CEST”. Running sntp again then got me the correct time.
Finishing up
Now, all I needed was to have this run everytime I turn on my Amiga 4000. Since it is already setting up a network connection upon loading Workbench, I wrote a small script at s:NTP-Startup like this:
wait 20
sntp server de.pool.ntp.org
and run this from s:user-startup like this:
IF EXISTS s:NTP-Startup
run >nil: execute s:NTP-Startup
Endif
Voilà! Works fine for me.