You are not logged in.
Pages: 1
Topic closed
I have a project that is taking temperature measurements and archiving to MYSQL if the temperature has changed by any more than 2 degrees. if the RPI/Rex loses power, the REX clock is not on time when powered up.
I have added in a DateTime block and when I monitor the outputs of this block I can see that the time is correct, however the "Current Time" in rex view is not.
Is the "OS Clock" the clock on the OS that is running Rex or the OS of the host that is running Rex view or rex draw?
I am not sure how to connect or configure the DateTime Block can anyone help?
Offline
Hi Darren,
thank you for your question. Can I ask you what HW exactly do you use? Is it plain Raspberry or combination with other HW? (asking because of not/presence of RTC module).
"OS clock" is the OS clock of your target device (e.g. Raspberry Pi). The "Current time" which can be found in RexView is REX clock (on your target device) with respect to your local settings on host computer (timezones, etc.).
The procedure for setting REX clock in current version (2.10.8) is as follows:
- on startup REX Core asks OS for current time in UTC and sets it as REX clock. However, OS clock doesn't have to be set up correctly in the time when REX Core is starting up
- afterwards REX clock just adds length of tick in every period and doesn't asking OS for current time any more (it can be synchronized by DateTime block)
Please, write me your HW configuration and I will let you know how to solve this issue - the solution will be different with/without RTC module.
Cheers, Tomas
Offline
Thanks Tomas,
I am using plain RPI with no RTC.
With the Rex getting UTC time from the OS, is this why the archiving is done with UTC date time stamp?
Can this be changed to local time using the DateTime block?
Cheers
Darren
Offline
Hi Darren,
if your "REX clock" and "OS clock" aren't for some reason synchronized, you can achieve it by using function block "DateTime" as you already mentioned. You just need to specify "Source for setting time" to "OS clock" and set rising edge to the "SET" input (e.g. using MP function block).
Reasons for unsynchronized REX time can be for example that the Raspberry Pi doesn't have the time already synchronized from NTP servers by the time of REX Core start.
According to your question with UTC Time stamp in Database export - as far as I know it is like you mentioned. However, it's not recommended to change the timestamp to your local time. DB entries are presumed to be in UTC and DB clients will change the time stamp to your local time zone.
If you require any further information, feel free to contact me.
Cheers, Tomas
Offline
Pages: 1
Topic closed