# Why does the getSeconds() function return a different value?

**URL:** <https://discourse.nodered.org/t/why-does-the-getseconds-function-return-a-different-value/66093>\
**Category:** General\
**Created:** [5 August 2022 22:14 UTC](https://discourse.nodered.org/t/why-does-the-getseconds-function-return-a-different-value/66093 "2022-08-05T22:14:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![m8nix](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@m8nix](https://discourse.nodered.org/u/m8nix)\
**Post date:** [5 August 2022 22:14 UTC](https://discourse.nodered.org/t/why-does-the-getseconds-function-return-a-different-value/66093/1 "2022-08-05T22:14:08Z")

</div>

Hi,

I'm just starting with "Node Red" and "JS" and I have a probably simple beginner's question.  
I intend to log an average value exactly every full minute in InfluxDB.

 ![getSeconds](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/b/9b01223a3734d13c9bc00356f5416934657d8909.png)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [5 August 2022 22:28 UTC](https://discourse.nodered.org/t/why-does-the-getseconds-function-return-a-different-value/66093/2 "2022-08-05T22:28:41Z")

</div>

The payload is the seconds on the node-red server, the time in the debug is browser time, They both increment by 1.

---

<div class="post-metadata">

**Author:** ![m8nix](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@m8nix](https://discourse.nodered.org/u/m8nix)\
**Post date:** [5 August 2022 22:36 UTC](https://discourse.nodered.org/t/why-does-the-getseconds-function-return-a-different-value/66093/3 "2022-08-05T22:36:23Z")

</div>

Ah, okay. Thank you.  
I hope the timestamps of the individual ioBroker modules are then synchronized? E.g. between Node Red and Influx?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [6 August 2022 07:39 UTC](https://discourse.nodered.org/t/why-does-the-getseconds-function-return-a-different-value/66093/4 "2022-08-06T07:39:48Z")

</div>

If node red and influx are on the same machine then they will use the same clock.

The fact that your server and PC are 15 seconds apart probably means that one of them has not got time synchronisation setup correctly. Machines setup to auto-sync from the internet should be less that a second apart.

> [@m8nix](#):
>
> I intend to log an average value exactly every full minute in InfluxDB.

What OS is the server running on? Linux and Windows are not a real time OS and occasionally processes will lock out others for a short time, so you cannot rely on sub-second response, or even within a few seconds occasionally. Why is it so critical that it is exactly one minute?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [20 August 2022 07:40 UTC](https://discourse.nodered.org/t/why-does-the-getseconds-function-return-a-different-value/66093/5 "2022-08-20T07:40:05Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
