I mentioned if I use “now” inside my rules it seems to be UTC always, not considering my timezone or daylight saving time. Same thing if I use charts the time is also UTC.
My workaround currently is to hard-code time difference and use a switch to set or unset daylight saving time. This is a bit awkward.
Does openHAB offer anything to consider timezone and daylight saving time automatically?
Currently I am using openHAB version 1.6.2.
As I am new to openHAB I think this is a beginner issue. So thanks in advance.
Have you configured the timezone on your computer? I never had to do anything special on my machines to get it to use the local timezone.
When you use the
datecommand, what timezone does it use? For example, I live in the US Mountain timezone so I get
Tue Oct 27 14:44:31 MDT 2015
The MDT stands for Mountain Daylight Time.
Check out these instructions for how to set your timezone on Linux.
“Obtains a DateTime set to the current system millisecond time […] in the default time zone.”
Thanks for the answers. I already checked my system time to be correct.
date-command results in “Mi 28. Okt 19:19:15 CET 2015”.
This is correct for me here in Germany.
Is there any difference between the system time and default time zone that joda-time refers to?
I mentioned in joda time documentation that now can take timezone as argument as well. Will try this next.
Took some time today to investigate the issue and traced down the root cause:
- My System time was set correct (thanks Rich for your hint)
- Also joda time “now” was referring to the correct time for my timezone (thanks Kai for the info)
Problem was that I auto-start openHAB from “rc.local”. It seems that sytem time initialization is not complete and “now” gives UTC. If I start openHAB from system prompt then “now” uses correct time-zone.
Issue closed for me now, thanks!