Project

General

Profile

Actions

Bug #119

closed

Need a way to set the TZ

Added by Hammel almost 12 years ago. Updated almost 12 years ago.

Status:
Closed
Priority:
Immediate
Assignee:
Category:
root file system
Target version:
Start date:
15 Jul 2012
Due date:
% Done:

30%

Estimated time:
Severity:
Critical

Description

This discussion seems to suggest that the TZ variable needs to be set in inittab. However, it isn't clear how to do that. Using a sysinit entry didn't work. Setting the value in /etc/init.d/S49ntp didn't work either.

Actions #1

Updated by Hammel almost 12 years ago

  • % Done changed from 0 to 30

It isn't clearly obvious how to do this. Some googling turned up the following, none of which seemed to work generically when logged in as root and running "date":
1. add TZ env var to /etc/inittab
2. add TZ env var to /etc/init.d/rcS
3. use /etc/TZ and point TZ to it
4. use /etc/localtime and point TZ to it
How you set TZ depends on whether you're using uClibc or glibc. I'm using glibc so using /etc/TZ or /etc/localtime seems reasonable. What is confusing is that glibc expects the whole /usr/share/zoneinfo directory hierarchy but that wasn't build with glibc for some reason. I'm not sure why. Possibly because cross compiling using host and target with different endianness doesn't work with locales, or something like that.

Variations on these were also tried. In the end, what worked seemed to be setting TZ=`cat /etc/TZ` in /etc/profile (the default profile for ash) and creating /etc/TZ with "echo MST7MDT > /etc/TZ". So now all that's needed is to manually set /etc/TZ and logging in will pick up the timezone.

Other tools will have to do similar things, such as rcS or maybe each inividual init script. I haven't tried referencing /etc/TZ in the X.org init script, for example. Nor have I found a way to set TZ globally. I can't do it on the Linux command line (I don't think) or via init and even if I could I couldn't dynamically change it. So setting it in /etc/TZ and manually referencing as needed seems the best option.

Actions #2

Updated by Hammel almost 12 years ago

  • Status changed from In Progress to Closed

Added /etc/profile and /etc/TZ, the former referencing the latter. Also updated S90UI to reference /etc/TZ.

This issue can be closed.

Actions

Also available in: Atom PDF