Why is the time in the NR log not local time?

#1

OSX: 10.13.6

When I start NR I notice that the time in the log looks to be UTC and not my local time. Is there a way to change it to show local time?

Here is a example:

Pauls-mini:~ Paul$ date
Sun Oct 21 06:38:35 EDT 2018
Pauls-mini:~ Paul$ node-red mudash.json
21 Oct 12:38:40 - [info]
Welcome to Node-RED

21 Oct 12:38:40 - [info] Node-RED version: v0.19.4
21 Oct 12:38:40 - [info] Node.js version: v8.9.4
21 Oct 12:38:40 - [info] Darwin 17.7.0 x64 LE
21 Oct 12:38:41 - [info] Loading palette nodes
21 Oct 12:38:41 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
0 Likes

#2

Hmmm... on my Pi the dates are the same:

pi@mqttpizw : ~ $ date
Sun Oct 21 07:03:10 EDT 2018
pi@mqttpizw : ~ $ node-red
21 Oct 07:03:25 - [info]
Welcome to Node-RED
===================
21 Oct 07:03:25 - [info] Node-RED version: v0.18.7
21 Oct 07:03:25 - [info] Node.js version: v8.11.3
21 Oct 07:03:25 - [info] Linux 4.14.52+ arm LE
0 Likes

#3

The reason is that system times should ALWAYS be in UTC not local time. This reduces any time processing issues. Only convert to local time on display.

On Linux systems - the system time will always be in UTC. You can set the timezone at the system level which will assist in conversions.

1 Like

#4

I think you have misinterpreted the question, the timestamps shown against messages in the node red log are normally in local time, on my systems anyway. In @zenofmud's they are in UTC. Could this be a Mac issue?

0 Likes

#5

OK, from the command line, run date to see what timezone the system is using. The command cat /etc/timezone will also show you.

If the timezone is incorrect, run tzselect (not sure if that needs to be run as sudo) or, perhaps better, run sudo dpkg-reconfigure tzdata.

You might need to try several of these methods if your Mac doesn't use one of them. There are also other possibilities that you will need to look up.

0 Likes

#6

If you look at the first post you will see that I did a 'date' right before runn NR - date shows the local date/time and NR shows the UTC date/time.

The second post shows running on a Pi where both 'date' and NR show the date/time as the local date/time

In addition my system log shows the local date/time.

It's something I'd never noticed before and wondered if there was a NR option to use the local date/time that I hadn't set on my Mac.

0 Likes