1

We are suffering from some date/time conversion issues so I am looking into any possible reasons.

During this I have stumbled on this strange issue when issueing the date command in Ubuntu 14.04.

date gives Thu Nov 26 11:05:50 GMT+1 2015

but date -u gives Thu Nov 26 12:05:53 UTC 2015

The commands are typed about 3 seconds apart, but the GMT+1 time is wrong, it should have been 13:05.

/etc/timezone is set to "Etc/UTC".

Output from timedatectl

Local time: Thu 2015-11-26 13:09:49 GMT+1 Universal time: Thu 2015-11-26 14:09:49 UTC Timezone: Etc/UTC (GMT+1, -0100) NTP enabled: yes NTP synchronized: yes RTC in local TZ: no DST active: n/a

Apparently that is the reason, but how can GMT+1 be -0100. (As dadexix86 answer explains that is correct behavior when using Etc/UTC.)

It may have been a messed up /etc/localtime file. After doing

sudo timedatectl set-timezone Europe/Copenhagen

date and date -u are now in synch.

(The problem was "Etc/UTC" turning around +/-. Not only did setting the timezone solve the date problem. Our conversion issues disappeared as well.)

2

The problem is Etc/UTC, that defines GMT-1 as one hour ahead of Greenwich (so in the east) and GMT+1 as one hour behind (so in the west), doing it in the opposite way as UTC does.

I refer you to this discussion on Stack Overflow for more detailed explanations.

So, I suggest that you change your timezone to UTC+1 or, better, to something like CET, so that you will not have problems with daylight saving time.

This is my timedatectl

timedatectl 
      Local time: gio 2015-11-26 15:14:20 CET
  Universal time: gio 2015-11-26 14:14:20 UTC
        RTC time: gio 2015-11-26 15:14:37
       Time zone: Europe/Berlin (CET, +0100)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: yes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.