2010-06-23 19:27:12     Use local time instead of UTC?

Document created by Aaronwu Employee on Aug 22, 2013
Version 1Show Document
  • View in full screen mode

2010-06-23 19:27:12     Use local time instead of UTC?

Gilles Ganault (FRANCE)

Message: 90571   

 

Hello

 

I installed NTP and made sure "/etc/TZ= CET", but "date" always displays the time as UTC instead of time in Central Europe (+2 in the summer, +1 in the winter).

 

Does someone if uClinux handles timezones/DST or we have to keep using UTC?

 

Thank you.

QuoteReplyEditDelete

 

 

2010-06-23 19:42:39     Re: Use local time instead of UTC?

Mike Frysinger (UNITED STATES)

Message: 90572   

 

set TZ in your env via /etc/profile

QuoteReplyEditDelete

 

 

2010-06-24 08:51:48     Re: Use local time instead of UTC?

Gilles Ganault (FRANCE)

Message: 90591   

 

Thanks Mike, but this is what the startup script does, and "date" stil displays time in UTC instead of local time.

 

root:~> cat /etc/init.d/ntp

 

        start) ntpdate pool.ntp.org&

 

               date;

 

               echo "export TZ=`cat /etc/TZ`" > /etc/profile;;

 

root:~> cat /etc/TZ

 

 

CET

 

root:~> cat /etc/profile

 

export TZ=CET

 

 

 

FWIW, instead of "CET", I also tried "Europe/Paris", rebooted, to no avail.

 

Could it be that "date" provided by Busybox only displays time in UTC?

QuoteReplyEditDelete

 

 

2010-06-24 12:18:11     Re: Use local time instead of UTC?

Mike Frysinger (UNITED STATES)

Message: 90595   

 

you didnt set TZ in the env *before* running date, so it wouldnt have mattered

QuoteReplyEditDelete

 

 

2010-06-24 18:01:55     Re: Use local time instead of UTC?

Gilles Ganault (FRANCE)

Message: 90611   

 

Thanks Mike for the hint, but I had rebooted the host already, and "date" still displays time as UTC, regardless how what's in /etc/TZ and /etc/profile:

 

 

 

 

 

root:/tmp> cat /etc/profile

 

export TZ=Europe/Paris

 

 

 

 

root:/tmp> set

 

TZ=Europe/Paris

 

PATH=/sbin:/bin:/usr/sbin:/usr/bin

 

TERM=vt100

 

SHELL=/bin/sh

 

HOME=/

 

 

 

 

 

I tried "Europe/Paris", and "CET", with no change. Maybe the "date" provided by Busybox 1.4.1 doesn't handle local time.

 

 

 

I'll just have to remember that files have their date/time in UTC, not local time.

 

Thank you.

QuoteReplyEditDelete

 

 

2010-06-24 21:30:01     Re: Use local time instead of UTC?

Mike Frysinger (UNITED STATES)

Message: 90618   

 

Europe/Paris is not a valid POSIX time setting.  then again, neither is CET.  please review the TZ documentation:

  www.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03

QuoteReplyEditDelete

 

 

2010-06-25 12:34:25     Re: Use local time instead of UTC?

Gilles Ganault (FRANCE)

Message: 90641   

 

Thanks a lot Mike, problem solved.

 

For those having the same issue, you'll find the right syntax here:

 

  www.di-mgt.com.au/wclock/tz.html

 

For instance, for Central European Time:

 

root:~> cat /etc/TZ

 

TZ=CET-1CEST,M3.5.0/2,M10.5.0/3

QuoteReplyEditDelete

 

 

2010-06-25 13:05:18     Re: Use local time instead of UTC?

Mike Frysinger (UNITED STATES)

Message: 90643   

 

thanks, ive added that link here:

https://docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:timezones

Attachments

    Outcomes