DateTime from system instead of ntp binding?

How can I get a DateTime item populated from the system clock rather than an ntp binding?

Seems like such a simple thing to do, but my search-fu is failing me.

Just don’t configure NTP and you should be set, I had to also set my timezone in with:

-Duser.timezone=America/New_York \

What does the item instance look like? When I remove the ntp binding reference what do I replace it with?

Just remove the ntp binding and java should pull time from your system.

Well… I feel dumb because it isn’t working. I removed the ntp binding so that my item looks like:

DateTime Date "[%1$tA, %1$td.%1$tm.%1$tY %1$tT]"

All I get in return is:

-, -.-.- -

You could write a rule that is run based on a cron expression, that looks something like:

import org.openhab.core.library.types.DateTimeType // not needed in OH2

rule UpdateClockItem
  Time cron "0 0/5 * 1/1 * ? *"
  Clock.postUpdate(new DateTimeType())

Ahhh… I get it now. I need something to cause an event that acts on the item.

Its working now.


1 Like

I chose to use the NTP binding and have NTP running as a service on my RPi.
The RPi is time synched with an Internet server and other RPi’s in my house are synched to the openHAB RPi.
So it was easiest for me configure the binding to “localhost” as the server address.