How to set linux timezone offset

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?



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: