Glam Prestige Journal

Bright entertainment trends with youth appeal.

We have an app that should timestamps logs with the local time, which is currently EDT. "/bin/date" clearly shows "EDT". But the app is stamping one hour in the past. I'm guessing it thinks it is EST.

/etc/sysconfig/clock contains: ZONE="US/Eastern"

How does the above help distinguish between EST and EDT?

2

2 Answers

According to 28.1.6. /etc/sysconfig/clock

ZONE= — The time zone file under /usr/share/zoneinfo that /etc/localtime is a copy of. The file contains information such as:

ZONE="America/New York"

Note that the ZONE parameter is read by the Time and Date Properties Tool (system-config-date), and manually editing it does not change the system timezone.

The /etc/localtime file is more important than the clock file: it is a table from which the computer determines when to switch between standard and daylight savings time, as well as which timezone-offset to apply. Note that this table can be overridden by the TZ environment variable, essentially by choosing a different table from the tzdata package (in case your application is for instance running as a service account with its own shell environment).

If (as suggested in a comment), your computer's clock is wrong, then you might consider setting up ntp to help with this.

All dates in RHEL, and most other Linux distributions are stored in UTC time by default. This includes the system clock. This is adjusted by the time zone in the routine to read the time.

The time zone offset is adjusted by date, hence setting the time. If the time zone is set to US/Eastern a program asks for the local time zone time it will read EDT during daylight savings time and EST during standard time. If the program asks for the offset of the system time zone it will report the one for EDT during daylight savings time, and the one for EST during Standard time.

You must note that some applications do not use system time zone, especially web applications. In these cases you must set the time zone in the application. If you are having issues with timestamps of a particular application being off an hour that may just be the case.

The other possibility is that the reference clock is set to the wrong time.

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy