You are not logged in.

#1 2016-06-22 17:17:59

killvanrea
Member
Registered: 2013-10-04
Posts: 32

[SOLVED] Wrong time returned from command 'date'

Hi everyone,
I have one annoying problem, that I can't solved.  Here is the problem

--(Wed,18:06:$)-- timedatectl 
      Local time: Wed 2016-06-22 20:11:16 EEST
  Universal time: Wed 2016-06-22 17:11:16 UTC
        RTC time: Wed 2016-06-22 20:11:16
       Time zone: Europe/Sofia (EEST, +0300)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no
--(Wed,18:11:$)-- date
Wed Jun 22 18:11:36 BST 2016
--(Wed,18:11:$)-- ls -l /etc/localtime 
lrwxrwxrwx 1 root root 32 Oct 27  2015 /etc/localtime -> /usr/share/zoneinfo/Europe/Sofia

As you can see my timezone and my utc time are correct but date command show me  BST time and don't know why. I've searched a lot in the forum posts but there are no one with a problem like mine, or I didn't find it. If someone know how fix it or know the post please tell me / redirect me so I can fix it.
All the best smile

Last edited by killvanrea (2016-06-22 18:28:15)

Offline

#2 2016-06-22 17:39:05

mis
Member
Registered: 2016-03-16
Posts: 234

Re: [SOLVED] Wrong time returned from command 'date'

Does it work with an other city in the same timezone. Europe/Tallinn for example?

Offline

#3 2016-06-22 17:47:34

killvanrea
Member
Registered: 2013-10-04
Posts: 32

Re: [SOLVED] Wrong time returned from command 'date'

I think no sad here is the output

--(vanrea@vanrea-arch)--------------------------------------------------------------------------------------------------------------------------------------------------------(/home/vanrea)--
--(Wed,18:45:$)-- timedatectl set-timezone Europe/Tallinn
--(vanrea@vanrea-arch)--------------------------------------------------------------------------------------------------------------------------------------------------------(/home/vanrea)--
--(Wed,18:46:$)-- date
Wed Jun 22 18:46:23 BST 2016
--(vanrea@vanrea-arch)--------------------------------------------------------------------------------------------------------------------------------------------------------(/home/vanrea)--
--(Wed,18:46:$)-- timedatectl 
      Local time: Wed 2016-06-22 20:46:28 EEST
  Universal time: Wed 2016-06-22 17:46:28 UTC
        RTC time: Wed 2016-06-22 20:46:28
       Time zone: Europe/Tallinn (EEST, +0300)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no
--(vanrea@vanrea-arch)--------------------------------------------------------------------------------------------------------------------------------------------------------(/home/vanrea)--
--(Wed,18:46:$)-- ls -l /etc/localtime 
lrwxrwxrwx 1 root root 36 Jun 22 18:46 /etc/localtime -> ../usr/share/zoneinfo/Europe/Tallinn

Somehow date command have her own timezone big_smile

Last edited by killvanrea (2016-06-22 17:48:39)

Offline

#4 2016-06-22 17:48:36

qdqdq
Member
Registered: 2016-06-21
Posts: 7

Re: [SOLVED] Wrong time returned from command 'date'

Does the following command display anything?

echo $TZ

Offline

#5 2016-06-22 17:50:30

killvanrea
Member
Registered: 2013-10-04
Posts: 32

Re: [SOLVED] Wrong time returned from command 'date'

yes I think you found my problem m8  tongue

--(Wed,18:46:$)-- echo $TZ
Europe/London

But where to find that param ...

Offline

#6 2016-06-22 17:55:53

qdqdq
Member
Registered: 2016-06-21
Posts: 7

Re: [SOLVED] Wrong time returned from command 'date'

killvanrea wrote:

yes I think you found my problem m8  tongue

--(Wed,18:46:$)-- echo $TZ
Europe/London

But where to find that param ...

Try the following commands

env --unset=TZ
echo $TZ

Offline

#7 2016-06-22 17:59:26

killvanrea
Member
Registered: 2013-10-04
Posts: 32

Re: [SOLVED] Wrong time returned from command 'date'

Nope m8 doesn't work, I've also checked my bashrc but nothing there.

--(Wed,18:54:$)-- env --unset=TZ
XDG_VTNR=1
SSH_AGENT_PID=696
XDG_SESSION_ID=c1
HADOOP_LOG_DIR=/tmp/hadoop/log
GLADE_PIXMAP_PATH=:
TERM=xterm
SHELL=/bin/bash
XDG_MENU_PREFIX=xfce-
HADOOP_PID_DIR=/tmp/hadoop/run
WINDOWID=18874372
ANT_HOME=/usr/share/apache-ant
USER=vanrea
GLADE_MODULE_PATH=:
SSH_AUTH_SOCK=/tmp/ssh-sE2BUUrYCcR8/agent.695
SESSION_MANAGER=local/vanrea-arch:@/tmp/.ICE-unix/688,unix/vanrea-arch:/tmp/.ICE-unix/688
MAVEN_OPTS=-Xmx512m
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
XDG_CONFIG_DIRS=/etc/xdg
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
MAIL=/var/spool/mail/vanrea
DESKTOP_SESSION=xfce
LC_COLLATE=en_US.UTF-8
PWD=/home/vanrea/git/XERP
HADOOP_SLAVES=/etc/hadoop/slaves
HADOOP_CONF_DIR=/etc/hadoop
LANG=en_US.UTF-8
XDG_SEAT=seat0
HOME=/home/vanrea
SHLVL=3
LOGNAME=vanrea
XDG_DATA_DIRS=/usr/local/share:/usr/share
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
WINDOWPATH=1
XDG_RUNTIME_DIR=/run/user/1000
DISPLAY=:0.0
GLADE_CATALOG_PATH=:
XDG_CURRENT_DESKTOP=XFCE
COLORTERM=xfce4-terminal
OLDPWD=/home/vanrea/git
_=/usr/bin/env
--(vanrea@vanrea-arch)-----------------------------------------------------------------------------------------------------------------------------------------------(/home/vanrea/git/XERP)--
--(Wed,18:57:$)-- echo $TZ
Europe/London
--(vanrea@vanrea-arch)-----------------------------------------------------------------------------------------------------------------------------------------------(/home/vanrea/git/XERP)--
--(Wed,18:58:$)-- sudo env --unset=TZ
TERM=xterm
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
LC_COLLATE=en_US.UTF-8
LANG=en_US.UTF-8
DISPLAY=:0.0
COLORTERM=xfce4-terminal
MAIL=/var/mail/root
LOGNAME=root
USER=root
USERNAME=root
HOME=/root
SHELL=/bin/bash
SUDO_COMMAND=/usr/bin/env --unset=TZ
SUDO_USER=vanrea
SUDO_UID=1000
SUDO_GID=0
--(vanrea@vanrea-arch)-----------------------------------------------------------------------------------------------------------------------------------------------(/home/vanrea/git/XERP)--
--(Wed,18:58:$)-- echo $TZ
Europe/London
--(vanrea@vanrea-arch)-----------------------------------------------------------------------------------------------------------------------------------------------(/home/vanrea/git/XERP)--
--(Wed,18:58:$)-- 

Last edited by killvanrea (2016-06-22 18:01:47)

Offline

#8 2016-06-22 18:01:15

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,808

Re: [SOLVED] Wrong time returned from command 'date'

The real question is, why is date reporting BST and not EEST?

What is the output of echo $TZ
?

Is TZ='Europe/Sofia' date
correct?

edit:  Slow posting today

edit 2  Try \date

Last edited by ewaller (2016-06-22 18:02:58)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#9 2016-06-22 18:03:00

killvanrea
Member
Registered: 2013-10-04
Posts: 32

Re: [SOLVED] Wrong time returned from command 'date'

Yes @ewaller the correct zone is Europe/Sofia but <echo $TZ> return Europe/London
date return me this

--(Wed,18:58:$)-- echo $TZ
Europe/London
--(Wed,18:58:$)-- date
Wed Jun 22 19:03:33 BST 2016
--(Wed,19:07:$)-- timedatectl 
      Local time: Wed 2016-06-22 21:07:32 EEST
  Universal time: Wed 2016-06-22 18:07:32 UTC
        RTC time: Wed 2016-06-22 21:07:32
       Time zone: Europe/Sofia (EEST, +0300)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no

Last edited by killvanrea (2016-06-22 18:08:29)

Offline

#10 2016-06-22 18:11:15

qdqdq
Member
Registered: 2016-06-21
Posts: 7

Re: [SOLVED] Wrong time returned from command 'date'

killvanrea wrote:

Yes @ewaller the correct zone is Europe/Sofia but <echo $TZ> return Europe/London
date return me this

--(Wed,18:58:$)-- echo $TZ
Europe/London
--(Wed,18:58:$)-- date
Wed Jun 22 19:03:33 BST 2016
--(Wed,19:07:$)-- timedatectl 
      Local time: Wed 2016-06-22 21:07:32 EEST
  Universal time: Wed 2016-06-22 18:07:32 UTC
        RTC time: Wed 2016-06-22 21:07:32
       Time zone: Europe/Sofia (EEST, +0300)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no

Does this command return anything?

cat /etc/profile /etc/bash.bashrc /etc/environment | grep TZ

Offline

#11 2016-06-22 18:11:38

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,808

Re: [SOLVED] Wrong time returned from command 'date'

But what did

TZ='Europe/Sofia' date 

Do?  That command sets the TZ variable temporarily while it runs date

The

\date

command that I also suggested runs date, ignoring any aliases. But, I no longer think that is your issue.  The issue is the TZ variable.

Did you cut and past any code into your ~/.profile, ~/.login, or other scripts that are sourced when you log in and start a shell.   Are you running some desktop environment that has settings in some GUI someplace that could be hosed?

Edit:  Again, I'm slow today smile

Last edited by ewaller (2016-06-22 18:12:19)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#12 2016-06-22 18:18:27

killvanrea
Member
Registered: 2013-10-04
Posts: 32

Re: [SOLVED] Wrong time returned from command 'date'

okay so i found in the wiki that the proper way to unset env is using unset TZ and then export TZ=''. So I did this

--(Wed,19:12:$)-- unset TZ
--(Wed,21:14:$)-- export TZ='Europe/Sofia'

and the result is

--(Wed,21:16:$)-- echo $TZ
Europe/Sofia
--(Wed,21:17:$)-- date
Wed Jun 22 21:17:14 EEST 2016

but my Viber still show British time sad maybe I must restart the pc

p.P.: I reboot but TZ is again Europe/Londond sad sad sad
the above command return nothing

cat /etc/profile /etc/bash.bashrc /etc/environment | grep TZ

OKAY FIX IT smile ^_^
So the problem was that in my ~/.profile I have this line

TZ='Europe/London'; export TZ

I've delete it and after reboot everything is correct. My terminal time, my widget clock, time in viber and etc. Thx alot to all smile
Marked as [SOLVED]

Last edited by killvanrea (2016-06-22 18:27:39)

Offline

#13 2016-06-22 18:26:46

mis
Member
Registered: 2016-03-16
Posts: 234

Re: [SOLVED] Wrong time returned from command 'date'

killvanrea wrote:

Somehow date command have her own timezone big_smile

Dating is not always easy. tongue

Does this return anything?

grep -sr 'Europe/London' ~/*

Offline

#14 2016-06-22 18:31:32

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,808

Re: [SOLVED] Wrong time returned from command 'date'

Let's look a little harder smile

Try:

find ~ -exec grep TZ \{\} \; 2>/dev/null

Edit:  I am still too slow

Last edited by ewaller (2016-06-22 18:32:07)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#15 2016-06-22 18:33:48

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,808

Re: [SOLVED] Wrong time returned from command 'date'

ewaller wrote:

Did you cut and past any code into your ~/.profile, ~/.login, or other scripts that are sourced when you log in and start a shell.

So, any idea how that got there in the first place?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#16 2016-06-23 08:07:44

killvanrea
Member
Registered: 2013-10-04
Posts: 32

Re: [SOLVED] Wrong time returned from command 'date'

No m8, I think some software that I've installed set it there, because I have one bad habit to copy paste command and not see what they do big_smile smile

Offline

Board footer

Powered by FluxBB