# Linux time ok, Openhab time not

**URL:** <https://community.openhab.org/t/linux-time-ok-openhab-time-not/157126>\
**Category:** Installation\
**Created:** [July 9, 2024, 4:04pm UTC](https://community.openhab.org/t/linux-time-ok-openhab-time-not/157126 "2024-07-09T16:04:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonus](https://community.openhab.org/letter_avatar_proxy/v4/letter/t/e274bd/32.png) [@tonus](https://community.openhab.org/u/tonus)\
**Post date:** [July 9, 2024, 4:04pm UTC](https://community.openhab.org/t/linux-time-ok-openhab-time-not/157126/1 "2024-07-09T16:04:05Z")

</div>

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:

```txt
$ 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:

```txt
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:

```sh
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!

---

<div class="post-metadata">

**Author:** ![milo](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@milo](https://community.openhab.org/u/milo)\
**Post date:** [July 9, 2024, 4:56pm UTC](https://community.openhab.org/t/linux-time-ok-openhab-time-not/157126/2 "2024-07-09T16:56:51Z")

</div>

See here [[SOLVED] Wrong local time. How to change?](https://community.openhab.org/t/solved-wrong-local-time-how-to-change/90938)

---

<div class="post-metadata">

**Author:** ![tonus](https://community.openhab.org/letter_avatar_proxy/v4/letter/t/e274bd/32.png) [@tonus](https://community.openhab.org/u/tonus)\
**Post date:** [July 11, 2024, 7:03am UTC](https://community.openhab.org/t/linux-time-ok-openhab-time-not/157126/3 "2024-07-11T07:03:25Z")

</div>

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 …).

---

<div class="post-metadata">

**Author:** ![milo](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@milo](https://community.openhab.org/u/milo)\
**Post date:** [July 11, 2024, 10:21am UTC](https://community.openhab.org/t/linux-time-ok-openhab-time-not/157126/4 "2024-07-11T10:21:00Z")

</div>

Hello,

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

> [@DateTime item shows UTC time although timezone is Europe/Berlin](https://community.openhab.org/t/datetime-item-shows-utc-time-although-timezone-is-europe-berlin/68159/2):
>
> It’s not a bug but reflects your system setup. Use ps to see if your java is given a timezone to start with. If no and your system clock runs on UTC that’s what java uses regardless of your local user’s TZ setting. Try adding "-Duser.timezone=Europe/Berlin" to the options line beginning with EXTRA\_JAVA\_OPTS in /etc/default/openhab2 an restart OH.

---

<div class="post-metadata">

**Author:** ![tonus](https://community.openhab.org/letter_avatar_proxy/v4/letter/t/e274bd/32.png) [@tonus](https://community.openhab.org/u/tonus)\
**Post date:** [July 14, 2024, 6:03am UTC](https://community.openhab.org/t/linux-time-ok-openhab-time-not/157126/5 "2024-07-14T06:03:03Z")

</div>

It has certainly to do with Java settings, thanks for pointing that out!  
I ran a small [java program to display](https://www.tutorialspoint.com/how-to-get-the-current-date-in-java) 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

```auto
/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

```sh
sudo dpkg-reconfigure tzdata

```

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