ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a question about time zone offset in Linux.
Since Linux supports all different Time zones and DSTs, each of the time zone offset constants, for example EST/PST/CST/MST, should have been defined somewhere such as a header file or, other mechanisms may be used by Linux.
They're pretty much all found in /usr/share/zoneinfo, particularly the file /usr/share/zoneinfo/localtime (a symbolic link to /etc/localtime).
When you installed your distribution you were asked what time zone to use and that got set for you.
It's worth a look a the timezone manual page for more information.
Hope this helps some.
Thank you! tronayne and Michael,
Sorry I did not mention that it is in an embedded environment and I realized that /usr/share/zoneinfo and /etc/localtime are actually not supported.
Just curious, could there be a header file which contains the constant definitions for time zone offsets?
Or, a Clib or system function that convert between the time zone offset value and a time zone name?
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
Perhaps you can do it the old-fashioned way by setting the TZ environment variable? You do not indicate where you are in the world but, for example, the eastern time zone in the United States is defined as
Code:
EST5EDT
where the EST is Eastern Standard Time, 5 is the difference to UTC during standard time, and EDT indicate that stupid... uh, daylight savings time is in use.
Embedded system? I dunno if setting TZ will do any good (and, of course, you've got to have the proper offset and a way to figure out when or if daylight time goes into effect) or you just set your system clock to UTC and be done with it, eh?
Perhaps you can do it the old-fashioned way by setting the TZ environment variable? You do not indicate where you are in the world but, for example, the eastern time zone in the United States is defined as
Code:
EST5EDT
where the EST is Eastern Standard Time, 5 is the difference to UTC during standard time, and EDT indicate that stupid... uh, daylight savings time is in use.
Embedded system? I dunno if setting TZ will do any good (and, of course, you've got to have the proper offset and a way to figure out when or if daylight time goes into effect) or you just set your system clock to UTC and be done with it, eh?
Hope this helps some.
Yes. It is very helpful. Thank you very much for the info.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.