Timezone not corresponding with correct time

Hi All,

All of a sudden (not sure when, maybe after an update) my time in Kodi is changed. It’s running 2 hours behind. I checked my “International” settings in the setting menu and all were ok.

My locale settings are set to;
Region: Central Europe
Timezone: Netherlands

Instead of 18.42u it shows 16.42u

When i SSH into my RPI and put in the command “date” it outputs;
Wed Oct 7 16:42:39 UTC 2015

If i’m right this needs to be UTC+2 (because of the summertime)

Is there a way to fix this? For now i’ve chosen a wrong timezone in Kodi to match the correct time. (it works)

Hopefully someone can help me out.

Change your timezone back to the one it should be

Then cat /etc/timezone.

Sam

Thanks Sam for your quick reply!

The output of the command is;
Europe/Amsterdam

This is correct. But still the time is 2 hours behind :wink:

When i use the following command with SSH “sudo timedatectl set-timezone CET” it corrects the time. But after a reboot it automatically is changed back when Kodi is launched.

Probably the wrong timezone is linked to my countrie? I’m not sure if this is in OSMC or Kodi?

Any ideas what to do?

I’ve noticed that there isn’t “Mountain Time”, instead I have to select Boise, Idaho to get my time. Which I don’t live in that state.

I had the same problem on a Fresh install 2 days ago on the September release. Mine was also 2 hours behind. I found this solution by @DBMandrake: Fix Date and time - #16 by DBMandrake

I did the steps and it worked, even after many reboots and 2 days of usage.

Hope that helps.

This would mean your issue is NTP related rather than timezone related

Sam

What steps are you talking about Mandr ?

The fixes described in that thread have been incorporated since RC3 (eg before the first stable release) and should NOT be needed now in fact by following them you are downgrading one of your system packages - so don’t do that…

@DBMandrake do you have another solution? As Mandr statet he had the same problem with the September release. I think mine occurred when updating to this release. (i’m not 100% sure)

I think you’re confusing two unrelated issues.

The fix discussed in the thread related to the time not being set at all during boot due to port 123 being blocked on the Internet connection.

To work around this we added a redundant method of updating the time from Google, Microsoft or Apple.

This has absolutely nothing to do with time zones or time zones being set wrong - ntp and the hardware clock in Linux always operate in UTC and are translated to your local time by applications when the time is read based on your time zone settings.

What time and time zone does it say if you type date over ssh ?

Wed Oct 7 13:50:39 UTC 2015

And it’s 15:50 right now.

Settings in Kodi are;
My locale settings are set to;
Region: Central Europe
Timezone: Netherlands

Linux sees the correct timezone. When i use the command; cat /etc/timezone it shows; Europe/Amsterdam which is correct

@DBMandrake I did the following steps that you wrote and it fixed my problem:

sudo apt-get update && sudo apt-get install ntpdate
sudo systemctl stop ntp
sudo ntpdate 0.debian.pool.ntp.org

I though it was a timezone issue, but it wasn’t as it was set to America/Toronto. I changed to a west cost timezone (-3 hours), and it was still 2 hours behind. I changed it back to America/Toronto, and it was still 2 hours behind. So that’s when I did some searching, and ran your 3 steps above and it corrected the time.

FYI, Sorry, I’m not at home and can’t do any testing at this moment in time.

No it doesn’t, otherwise date would be giving you the correct time and time zone rather than being 2 hours behind and saying UTC. (Universal Coordinated time, also known as GMT)

/etc/timezone is not the primary configuration used in Debian for most software, so while it too must be updated for compatibility with all software the primary controlling factor is /etc/localtime, which is a binary file copied from /usr/share/zoneinfo/timezone where timezone is the name of your timezone. (Europe/Amsterdam)

You can see where we do this on Kodi startup in this patch to Kodi:

The point of this patch is that on Kodi startup and also if you change the time zone in the Kodi GUI, both /etc/timezone and /etc/localtime are updated to sync the system timezone settings with the Kodi timezone settings.

Apparently this is not working correctly so it would be interesting to figure out why. Can you check to make sure that the file /usr/share/zoneinfo/Europe/Amsterdam does actually exist ? Also please post your system journal so we can see whether Kodi is running the correct command on startup to copy the localinfo file:

grab-logs -J

If I had to guess what the problem might be, it would be that there could be a slight naming mismatch between your timezone in Kodi and the name/path of the localinfo file in /usr/share/zoneinfo.

The patch you mentioned seems to work because both files are present and overwritten on boot and when i change the timezone in the Kodi GUI.

/etc/timezone i can read in Notepad++ and says; Europe/Amsterdam
/etc/localtime i can’t read in Notepad++

Also the file /usr/share/zoneinfo/Europe/Amsterdam exists

Here’s an export of my system journal; http://paste.osmc.io/cerugosiqi

Hopefully you can find what’s going wrong.

I don’t see the issue, but your system is suffering from corruption:

Oct 08 20:05:55 osmc systemd[223]: Failed at step EXEC spawning /usr/sbin/vsftpd: Exec format error

And

Oct 08 20:05:54 osmc kernel: EXT4-fs error (device mmcblk0p2): htree_dirblock_to_tree:987: inode #859: block 8802: comm systemd: bad entry in directory: rec_len is smaller than minimal - offset=0(0), inode=0, rec_len=0, name_len=0

Sam

And do you have a solution for that?

After i made an backup i did a clean install and restored the backup! The time is correct again!!

Could someone please verify if my system journal is ok?
http://paste.osmc.io/juluvefote