# NTP Time Server Node

**URL:** <https://discourse.nodered.org/t/ntp-time-server-node/76984>\
**Category:** General\
**Created:** [27 March 2023 11:38 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984 "2023-03-27T11:38:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![damica51](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@damica51](https://discourse.nodered.org/u/damica51)\
**Post date:** [27 March 2023 11:38 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/1 "2023-03-27T11:38:10Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![iiot2k](https://avatars.discourse-cdn.com/v4/letter/i/8baadc/32.png) [@iiot2k](https://discourse.nodered.org/u/iiot2k)\
**Post date:** [27 March 2023 12:45 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/2 "2023-03-27T12:45:30Z")

</div>

Hi,  
which node do you use ?

---

<div class="post-metadata">

**Author:** ![damica51](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@damica51](https://discourse.nodered.org/u/damica51)\
**Post date:** [27 March 2023 13:25 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/3 "2023-03-27T13:25:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![iiot2k](https://avatars.discourse-cdn.com/v4/letter/i/8baadc/32.png) [@iiot2k](https://discourse.nodered.org/u/iiot2k)\
**Post date:** [27 March 2023 13:42 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/4 "2023-03-27T13:42:07Z")

</div>

I work on Node to add this feature.

---

<div class="post-metadata">

**Author:** ![iiot2k](https://avatars.discourse-cdn.com/v4/letter/i/8baadc/32.png) [@iiot2k](https://discourse.nodered.org/u/iiot2k)\
**Post date:** [27 March 2023 16:25 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/5 "2023-03-27T16:25:53Z")

</div>

Is online

---

<div class="post-metadata">

**Author:** ![damica51](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@damica51](https://discourse.nodered.org/u/damica51)\
**Post date:** [27 March 2023 22:05 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/6 "2023-03-27T22:05:26Z")

</div>

OK, keep me posted. Thanks

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [27 March 2023 23:23 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/7 "2023-03-27T23:23:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![damica51](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@damica51](https://discourse.nodered.org/u/damica51)\
**Post date:** [28 March 2023 01:12 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/8 "2023-03-28T01:12:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [28 March 2023 03:18 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/9 "2023-03-28T03:18:57Z")

</div>

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

[https://www.server-world.info/en/note?os=Debian\_11&p=ntp&f=3](https://www.server-world.info/en/note?os=Debian_11&p=ntp&f=3)

Craig

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [28 March 2023 03:25 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/10 "2023-03-28T03:25:13Z")

</div>

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

Craig

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [28 March 2023 08:11 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/11 "2023-03-28T08:11:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [28 March 2023 08:44 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/12 "2023-03-28T08:44:35Z")

</div>

generally best to pick a pool - see [pool.ntp.org: How do I setup NTP to use the pool?](https://www.ntppool.org/en/use.html)

---

<div class="post-metadata">

**Author:** ![iiot2k](https://avatars.discourse-cdn.com/v4/letter/i/8baadc/32.png) [@iiot2k](https://discourse.nodered.org/u/iiot2k)\
**Post date:** [28 March 2023 09:02 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/13 "2023-03-28T09:02:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![damica51](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@damica51](https://discourse.nodered.org/u/damica51)\
**Post date:** [28 March 2023 10:56 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/14 "2023-03-28T10:56:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![iiot2k](https://avatars.discourse-cdn.com/v4/letter/i/8baadc/32.png) [@iiot2k](https://discourse.nodered.org/u/iiot2k)\
**Post date:** [28 March 2023 12:39 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/15 "2023-03-28T12:39:31Z")

</div>

Here is an application of the NTP node:  
 ![Time](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/b/4bb1be7e425100af6df986e3dc0fc43990dc2d5a.png)

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.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [28 March 2023 13:35 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/16 "2023-03-28T13:35:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![iiot2k](https://avatars.discourse-cdn.com/v4/letter/i/8baadc/32.png) [@iiot2k](https://discourse.nodered.org/u/iiot2k)\
**Post date:** [28 March 2023 14:01 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/17 "2023-03-28T14:01:13Z")

</div>

**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 🙂

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [28 March 2023 15:30 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/18 "2023-03-28T15:30:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![iiot2k](https://avatars.discourse-cdn.com/v4/letter/i/8baadc/32.png) [@iiot2k](https://discourse.nodered.org/u/iiot2k)\
**Post date:** [28 March 2023 17:42 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/19 "2023-03-28T17:42:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)\
**Post date:** [28 March 2023 17:58 UTC](https://discourse.nodered.org/t/ntp-time-server-node/76984/20 "2023-03-28T17:58:31Z")

</div>

> [@iiot2k](#):
>
> 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.

[Next page](https://discourse.nodered.org/t/ntp-time-server-node/76984.md?page=2)
