Linux time ok, Openhab time not

My Linux time differs from my Openhab time with one hour, after installing Openhabian 1.9b a week ago. What to do about that?

  • Platform information:
    • OpenHabian 1.9b (32bits)
    • Hardware: Raspberry PI 3b/1GB RAM/ 16 GB storage
    • OS: Raspian 12 (Bookworm)
    • Java Runtime Environment: openjdk version “17.0.11” 2024-04-16
    • openHAB version: 4.1.3

Linux time and timezone:

$ timedatectl
               Local time: Tue 2024-07-09 17:48:52 CEST
           Universal time: Tue 2024-07-09 15:48:52 UTC
                 RTC time: n/a
                Time zone: Europe/Berlin (CEST, +0200)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

But whether I use the default situation (i.e. setting no timezone in Openhab, OH should take over the Linux timezone), or even when I manually configure to Athens instead of Berlin, the logfile and time in Openhab remains on +1 instead of +2 where it should be now.

Top of the log when restarted at 17:35:

2024-07-09 16:35:51.501 [INFO ] [org.openhab.core.Activator          ] - Starting openHAB 4.1.3 (build Release Build)
2024-07-09 16:35:52.567 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Time zone set to 'Europe/Athens'.
2024-07-09 16:35:52.590 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Locale set to 'nl_NL'.
202

Also dates in items (like LastUpdate values) are one hour off.

By the way, it is a remote system (no access to the ui), so I changed the timezone using openhab-cli:

openhab> config:edit (service.pid=org.openhab.i18n)
openhab> config:property-set timezone Europe/Athens
openhab> config:update
openhab>                       

I did this before and this used to work.

  • What to do to fix this?
  • What to check?

I’d appreciate any help!

See here [SOLVED] Wrong local time. How to change?

Thanks @milo for your reaction The link you sent is mostly about setting the linux time. But my Linux time is ok, it is just OH does not take over the Linux time correctly (as I am used to), or it does not seem to react on the commands in the openhab-cli (still have to try the webui …).

Hello,

There was a link in the link about the same problem have look here

It has certainly to do with Java settings, thanks for pointing that out!
I ran a small java program to display the date, compiled in on a laptop, and copied it to the Pi. That had the same (and incorrect) time output as Openhab.

Using search engines, I found that the textfile

/etc/timezone

had a different timezone than timedatectl reported. I corrected this using a texteditor, started openhab again, and now the time is ok!

I guess dat java looks to /etc/timezone (perhaps only in my specific situation, the root cause of my issue that I still don’t know), and not to the linux time.

I do not remember what I did to set the timezone. I did not use openhabian-config for that. That is the recommended way of doing this. Is uses

sudo dpkg-reconfigure tzdata

Perhaps I used only timedatectl to set the correct timezone, and that appears not to be enough.