0
I'm trying to set the time in an embedded system ...
There isn't a link/file /etc/localtime
and /usr/
has only two subdirectories /usr/bin
and /usr/sbin
.
Is there something I can try or do I just give up and make UTC be my timezone?
0
I'm trying to set the time in an embedded system ...
There isn't a link/file /etc/localtime
and /usr/
has only two subdirectories /usr/bin
and /usr/sbin
.
Is there something I can try or do I just give up and make UTC be my timezone?
1
You can probably just set TZ, something like : TZ=":America/New_York" and then any time conversion function is going to make a call to tzset() that will help it get the right time (Atleast the man page of tzset says so). You can do the same too, if you are writing an application that needs time information. Don't take my word for it ;) I am just saying what the man page says. You should go check it out yourself.
1
Try setting the TZ environment variable in /etc/profile to something that looks like TZ=EST5EDT for 5 hour offset from UTC if your location doesn't do daylight savings just give it a timezone code & UTC offset. for example India Std Time would be TZ=IST-5:30
the TZ environment variable is a posix standard you can read more about it. http://www.gnu.org/s/libc/manual/html_node/TZ-Variable.html
Better to use
/etc/environment
, I think - files like/etc/profile
are usually not parsed until and unless for a shell, likebash
etc. It is better to use the environment file because that sets up the timezone for all system processes, not just those started by the shell, and which I think should also know about the timezone being specified. – amn – 2014-04-14T09:55:42.273