Is there an Item for Now()?

This is obviously really a newbie question…

… but is there a standard Item that carries the DateTime value of Now() from the local clock?

Reason is that I just want to drop that Item into Basic UI.

I looked at some obvious bindings that might have something related to Now() e.g. Astro, and Systeminfo but could not find anything. Perhaps another binding implements this? Or if not, then I might even modify one of those (probably SystemInfo) to add such a channel…

Nope.

Make one:

rule "Clock tick"
when
   Time cron "5 0/1 * * * ?" // each minute, offset by 5secs
then
   someDatetimeItem.postUpdate(new DateTimeType())
end

Ok. Not the answer that I expected.

Did you look at the demo items?
Using NTP Binding you can use this item

DateTime CurrentDate            "Date [%1$tA, %1$td.%1$tm.%1$tY]"   <calendar>  { channel="ntp:ntp:demo:dateTime" }
2 Likes

yes… the NTP binding

But, the NTP binding really won’t give you now, as it updates every 60 seconds by default. :wink:

Of course you could change the frequency to every second and it would be much closer to now.

Really depends on the accuracy you’re after.

Of course, but what would the OP want to achieve with having the DateTime value of Now() in Basic-UI ?
Seems to me as if he wants to have a “clock”

1 Like

I prefer @hmerk ‘s NTP binding solution is over the rule proposed by @rossko57 because it is a standard Thing / Item versus a complex programmed solution. I think the concern about refresh rates is irrelevant since a) @rossko57 ‘s rule refreshes every 60 seconds, and @hmerk ‘s solution ALSO refreshes every 60 seconds…

1 Like

Probably true, but I didn’t want to assume. :wink:

FTR, it was @hmerk’s recommendation.

Yes. Prior post corrected…

1 Like

umm, it is a one line rule. It’s going to get tougher from here on in, I’m afraid :wink:

The NTP solution does the same job just fine, at the expense of installing a binding. My host system does its own periodic NTP corrections, so I happen not to need that.

Question for NTP users - do the regular updates keep coming (based on internal clock) if you lose the NTP internet connection? I would imagine they do.

Yes, it only refreshes from the NTP server every so often (I forget the default frequency). Even if it can’t get refresh from the NTP server, it will just continue to use the local system time.

Yes, they do.