NTP Time Server Node

I have looked at the NTPTime node for getting the time from an Internet time server, this node would work for me if I could make it not update as often. If seems that the slowest I can set is every 10 seconds.

I need something more like every 6 hours.

Does anybody have another solution?

which node do you use ?

I have tried both "Node-Red-Contrib-iiot-ntptime" and
"Node-Red-Contrib-redplc-ntptime". Both can't set scan time any slower than 10 seconds.

I work on Node to add this feature.

Is online

OK, keep me posted. Thanks

Why do you want a node to do this? Your OS should do it.

I'm want to use a Raspberry Pi, and they will be used as an "Edge Of Network" device (very remote locations) I have 100's that I want to implement and I pay for bandwidth. If I have 100's of these units acessing the internet every 10 seconds that will consume a lot of bandwidth I don't want to pay for.

You don;t - instead you use the NTP function of the OS (Debian) to setup a remote NTP server - the server will synchronize on a regular basis - but not every 10 seconds

You can then set up and colocated devices to use the master RPi as an NTP server and thus save them from going out to the internet

Here is how you can configure it on Debian - note the longest delay is approx 34 minutes



You could also just setup a cron job to stop the NTP client service and start it every couple of hours


Linux has built-in NTP. Set the correct timezone and appropriate country NTP server (usually a group so that the NTP server can pick the best one). It should query no more than once an hour if I remember rightly, quite possibly only once a day. More than sufficient. No CRON, Node-RED or anything else needed.

generally best to pick a pool - see pool.ntp.org: How do I setup NTP to use the pool?

1 Like

The nodes are not intended to update the system time.
That's why the nodes work on every system.
The nodes aim to access the date and time elements for later processing.
If you have access to the internet, why not use NTP?
For example, the node-red-contrib-redplc-ntptime node stores in global context variables.
Therefore date/time queries can be made with it.
@damica51 should use the node-red-contrib-redplc-systime or
node-red-contrib-iiot-systime for time queries.
These query the system time.
Of course you can make a node that updates the system time via NTP.
But that is actually the task of the operating system.

1 Like

Thanks everyone I will continue to do some more research on this matter. I don't think I have it totally figured out just yet.

Here is an application of the NTP node:

Q0.21 is an output on the Raspberry Pi.
IA88.2 are hours on NTP Node.
IA88.4 are weekdays on NTP Node.
Q0.21 is activated if hours between 12..18 AND weekdays outside of Sunday and Monday.

It is only intended to serve as an example.
I am currently working on these nodes and they are not ready yet.

I too was wondering in what circumstances I would use Node-Red-Contrib-iiot-ntptime or Node-Red-Contrib-redplc-ntptime.

Sorry @iiot2k but your example application above leaves me completely bamboozled!

Doesn't node-red-contrib-cron-plus allow me to turn a relay ON between 12:00 and 18:00 Monday - Friday?
It uses the system clock which should be synchronised with NTP anyway.

node-red-contrib-cron-plus is a very general purpose node.
Of course, the nodes in the example can also compare other
number sources (e.g. from an analog-to-digital converter).
You can link the nodes in any combination (AND, OR ..).
Many roads lead to Rome :slight_smile:

Except that the public NTP service most certainly should not be spammed for this purpose. That is why all OS's handle it at the OS level. The NTP services are run as a free public service. If you want to do more rapid scans of NTP, run your own local NTP service that links to a public one. In fact, if you read the terms of service for NTP servers I believe that you will find instructions in them not to repeated query them as this can block the service for other people.

Sorry, but I can't personally see any reason to use a node like that.

If I want to make use of the current time, I can get it from JavaScript or from JSONata directly. It will be absolutely correct, certainly to well within a second since the server (and my desktop) keep accurate time thanks to occasional links to public NTP. Indeed, that is an absolute necessity if you need to do any work with certificates.

If there is such an aversion to the NTP node, I will delete that node.
Before that I would like to ask the forum community if I should delete it.

Don't do this.
Your node has got about 15 downloads per week over the last year; there seems to be an interest in it - despite some people here expressed strong arguments against using it.
That's yet the nature of free speech ... and a situation you have to cope with when trying to contribute to a community effort.