Generate date/time information for NTP log files (loopstat and peerstat)

I have to evaluate NTP (Network Time Protocol) log files a lot. In these log files a special format for dates and time is used, which is not the standards Unix time format. It cannot be transformed into something readable with the calculation transformation (MSecToDateTime) directly.

I build some transformation steps to get it calculated to Unix format and make it readable. Maybe it helps in case somebody has to handle such data, too.

NTP format:

I replaced in my example file the separating “.” in seconds to a comma (working in German environment, where comma is the separator for decimal places)

The result looks like, including 1/1000 seconds:

It is done by a chain of calculations, the trick was to find the correct values for it:

NTP Time tranform.transform (11.1 KB)

1 Like

Thanks. What is the day based off? If I subtract 60006 from 2023/03/23 I get 1858/12/7, which seems an odd zero date!

it is a nightmare of algorithm and used basis I identified by try and error, but I searched now and in the RFC 5905 specification I found the following, which fits with my implementation:

Day value 15020 is 1st Jan 1900.

Entering the days 0 and 15020 in my transformation it shows:


The other challenge was that the first step in my calculation showed than a Unix date at 01:00 o’clock. when this is sorted out the rest is simple. Crutial is to still have the 1/1000 seconds in the process which is given in MSecToDateTime calculation.

Strange standard! I wonder what happened in December 1858? ;0)

1 Like

You learn something new every day!

I particularly like:

Note that the OpenVMS time display and manipulation routines allow for
only 4 digits in the ‘YEAR’ field. We expect this to be corrected in
a future release of OpenVMS sometime prior to 31-DEC-9999.