# PH Synctime

Probe House Software
by Wong CK
© Copyright 2012-2019
Version 1.3

## What is this?

PH SyncTime is a simple program that checks and syncs the computer clock with a Network Time Protocol (NTP) server. It uses the simple version of NTP, simply called Simple Network Time Protocol (SNTP), duh! This SNTP does not take into consideration the time interval during the communication with the NTP server. This means it is not as accurate as the full-blown NTP sync application, the trade off - is just being plain simple.
The reason for making this application is because the available NTP client on the Atari seems to sync the hardware clock to UTC time. This is the normal case where big computer systems like UNIX and Windows runs on UTC time. For the Atari, this is fine if your system is on UTC or uses UTC time even for TOS. But on my system it is set to local mode, meaning the hardware clock is showing the time like it on my wall clock, not UTC time. This small app understands local time mode (hopefully) and will sync the hardware clock accordingly.

## Use UTC or Local time in Mint?

In TOS and MagiC, the system Real-Time Clock (RTC) normally follows the time on your wall clock, which is called local time. These OS have no knowledge of time zone. The main item that is time stmped in these OS are the files, when you list the folder directory, it shows you the time the file was changed.
Mint on the other hand can be configured to understand time zones. When done so, Mint uses Unix time as it's main time system, meaning the Mint kernel runs in UTC. Mint implements the timezone database, so it knows many cities and countries time zone. Thus Mint can easily exchange timestamped information with other computers. In this mode, Mint system RTC should run in UTC.
There are problems when the system RTC is running in UTC.

1. Firstly, the system will think that you are living in UK. No big deal actually, but when you exchange files or information on the web, it may be misleading on the other computer.
2. Secondly, files written to the local disk will show up in wrong time when you list the folder in TOS, MagiC compared to Mint.
3. Thirdly, if an old TOS/GEM application reads the time directly from the RTC, it will show UTC time, different from your wall clock time creating confusion and other timing issues.

The solution will be able to run the Mint kernel in UTC with time zones, but allowing the local time to be set in the RTC. With this, Mint knows that you stay somewhere else other than UK. And the second and third issues will be gone as the RTC used by TOS/MagiC and old TOS/GEM applications shows the local time as expected. This special mode can be configured by running the tool called tzinit with parameter -l ( "tzinit -l") and should be done as soon as the Mint system is up.
It is this special case of local time mode that PH Synctime understands and sync your RTC to the calculated local time rather than UTC.
However, if you don't install the time zone stuff on Mint ( no time zone utilities and no tome zone database ) Mint will degenrate to the same as TOS and Magic, where by the local time is also deemed as UTC, and you will be deemed as living in UK by your Atari.

## Requirements

This runs on Mint with MintNet and requires internet connection. Time zone setup is not neccessary.
If time zone is setup,it will automatically query the system for it. Otherwise you will have to manually select the time zone from a drop down menu.
This program uses MINT threads, so a newer version of MINT will be better, like v1.18.
The application is compiled for the differnt CPU architecture of Atari ST range:

- For M68000, use the program STNCTM00.PRG
- For M68030, use the program STNCTIME.PRG

## Daylight saving time

The daylight saving time (DST) dates changes every year and so maintaining it will be horrendous. MINT time zone information will make an attempt at calculating the DST of a country. If this calculation misses by a few days or is wrong, please inform the app if your country is currently in DST, by switching on the DST field.

## The App layout

- Computer time displays the time using your computer.
- Hardware (HW) clock mode displays the meaning of the computer clock. If it is in local time, it means the time in the computer clock is storing the local time. If it us UTC, it means the time in the computer clock is storing the current UTC time.
- Timezone is as set in your system. The parenthesis shows the offset from UTC/GMT
  If your Mint is not setup with time zone information, you will be allowed to select your time zone by clicking on the "Timezone" word
- NTP Server is the NTP server this app will talk to. You can edit and change to another nearer to you.
- Status is the message area.
- DST is a switch to toggle DST in your country.
- SYNC is a switch to toggle between update and check mode. Selecting it will UPDATE the system clock. Unselecting it will put the app to CHECK mode and will not update the system clock
- UPDATE button perform the task to sync and update the system clock. This button can be CHECK if the toggle SYNC is unselected.
- CLOSE button Exits the app.

## Usage

1. Make sure Mint is running and you have Internet connectivity.
2. Check that the NTP server of your choice is reachable. The default is pool.ntp.org, which is a pool of NTP servers serving clients for free. You may change it to one of the NTP servers in your country. The project website is here.
3. If your country is currently in DST, toggle ON the DST tick box.
4. If you want to UPDATE the system RTC, toggle ON the SYNC tick box.
5. Click on the UPDATE/CHECK button to begin the process. You see will the progress of the process in the message area.

Finally you will see the time from the NTP server, which is in UTC time, and the difference between it and your system time with time zone information accounted for.

## Running as start-up

You can run SyncTime in the strart up of XaAES/N.AES/MyAES config file. In this mode, it will sync the Atari time with the time server. There will not be a GUI and it will exit out after syncing the time. It will not display any status unless the parameter 'V' is added to the command line or sometimes an error message. Any status will be displayed on to the screen via BIOS characters output, so have a console to catch these output.
Note:

1. This program is multi-task aware and uses events, so you need AES to be running in order to use it.
2. Best place as start up in the XaAES/N.AES/MyAES config file.

## Timezone - Auto or Manual

If you setup timezone on your Mint, PH Synctime will detect this and automatically use the detected timezone. it will write the word "Auto" after the timezone abbreviation. If it cannot detect the timezone, it will write out "Manual" after the timezone abbreviation and allows you to select your timezone from the pulldown menu on the timezone line header.

## Config file

The config file is called synctime.cfg located at the same folder of the app. It is created by the app itself. The 1st line is the DST settings and the 2nd line is the last used NTP server name and the 3rd line is the manually entered timezone. If you need to set back to the default NTP server, just delete this file away. You should also be able to edit this file with any editor.

## Limitations

- DST for one, see above entry about it.
- Clicking multiple times on the UPDATE/CHECK button quickly and the program will hang due to event messages becoming unsynchronised with the actions of the program. So just don't do it ( or do, if you want to see this happening) !!

Questions, comments, or error reports? Please leave a post at Atari-Forum.com
Visit my web site at https://sites.google.com/site/probehouse/