Home/Support/Support Forum/How to set linux timezone offset
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

How to set linux timezone offset

0 votes
Is there a way to set the local timezone offset with the Linux DigiConnect ME device? I plan on reading log files from a CLI program that have UTC timestamps and display them using the current local time.

I noticed that there is no zoneinfo database on the device. Perhaps this is because of the total size involved.

The CLI will be a C application and would be use the standard library functions to convert to local time (e.g., localtime()).

I've tried building the zoneinfo data and copied that to /usr/share and created a symbolic link to /etc/localtime -> /usr/share/zoneinfo/America/Chicago, but that had no affect. Also setting TZ variable to '/usr/share/zoneinfo/America/Chicago' or 'America/Chicago' had not effect.

Perhaps the c-runtime needs to be built having knowledge of the zoneinfo data??

If I set the TZ variable to a value that has the timezone offset in it, only then will it adjust the local time. e.g., TZ='CST6CDT5,M4.1.0/02:00:00,M10.5.0/02:00:00' will affect the value returned from localtime() and adjust for DST. Is this the only option I have?

Thanks,

Todd
asked Jan 18, 2013 in Linux by toddlange1 New to the Community (0 points)
recategorized Sep 20, 2013 by tuxembb

Please log in or register to answer this question.

1 Answer

0 votes
is this about Digi Connect ME (7520 cpu) with uClinux 2.4.22 or about Digi Connect ME 9210 with Digi Embedded Linux 5.7 (kernel 2.6.35)?

typically adding the correct timezone files to the rootfs should help, just search the web for "how 2 set Linux time zone"

For the Digi Connect ME 9210 with busybox the following seems to work:
/ # date
Fri Oct 17 08:39:16 UTC 2012
/ # echo "GMT-2" > /etc/TZ
/ # date
Fri SepOct 17 10:39:41 GMT 2012

see more information about the /etc/TZ file:
https://stackoverflow.com/questions/28491719/tz-variable-custom-file
answered May 2, 2013 by User143 Community Contributor (132 points)
edited May 17, 2021 by User143
...