Time.h with millisecond support for my NTP-Server?

Hi,

i've build my own (S)NTP-Server with an Arduino Mega and and external RF-Timecode Module
that receives EFR-Timecode that is much more accurate than a DCF-Timesignal. So, the time is
accurate down to 1/256s.

I use the Time-Library from the Playground so i have a software-RTC, and do a sync with the
RF-Module every 10 seconds. I need the software RTC to do some other stuff in the background,
the arduino itself has also some other things to do. And i can't request the current time not every
second from the external module, so i need a software RTC...

I also implemented a NTP-Server that receives request from clients and sends back the correct
time with "Daylight saving" (its called summertime here in europe), so all my NTP-Clients allways
have the right time. (i hate that summertime thing) :slight_smile:

So, currently when i receive the actuall time from the rf-module, i took the Subsecond-Information,
do a little delay with that, and than updating the Software-RTC at the next Full Second.

Is there any other Time library out, that can handle Subsecond/Milliseconds too?

Because of this resolution limitation of a second in the current library, i have to delay also my NTP
responses to the client to be in sync with a full second change.

It would be awesome when there would be a library similar to the Time.h, but also with a Subsecond
parameter...

Thanks!

With best regards,
Martin Lang

I need the software RTC to do some other stuff in the background,

What background? The Arduino is a single process system. There is no "background".

i took the Subsecond-Information,
do a little delay with that

How is that better than doing nothing if it isn't time. Hint: it ISN'T.

It would be awesome when there would be a library similar to the Time.h, but also with a Subsecond
parameter...

The Time library keeps track of time to better than one second resolution. It simply has no method to report that. So, add one.

I tried it, but i can figured it out to work correctly… so maybe someone has still a running Time-Library with subsecond support???

I got it, thanks for the hint...

I'd be interested if you make any mods to the Time library to support millisecond resolution, I've been thinking along similar lines.

Two years later… I added adjustTimeMS() It appears to work fine, but if someone else wants to try it, that would be great.

Time.cpp (9.02 KB)

TimeLib.h (6.51 KB)