1

I just been bugged by the Day light saving hours

I seem that 3rd November 2013 01:00:00 start EST time

Now ever Time I set my time to 3rd November 2013 00:58:xx(some seconds)

and run date

it give me valid Time zone i.e EDT

but

even after the time pass 01:00:00 and I still query the date library

I still see the Time zone as EDT and not EST

have a look at this screenshot enter image description here

You can clearly see the Time zone saying as EDT even when it is EST

any one has a clue for this

Update

There is one other finding I found if I restart my machine I see this

enter image description here

3 Answers 3

2

The behavior you describe is as expected. See this site for detailed confirmation. You may also want to review the description here.

Since DST is ending in the fall, and the clocks move backwards, we call this the "fall back" transition. As your clock is approaching 2:00 AM, it falls back to 1:00 AM instead. The local time from 1:00:00 to 1:59:59.999 is repeated. By the time 2:00 hits, it's already repeated the second instance of the 1:00 hour and DST is well over.

We use the label EDT for Eastern Daylight Time, when the offset is at UTC-04:00, and the label EST for Eastern Standard Time, when the offset is at UTC-05:00. So no, EDT and EST are not the same. It does matter which one you are in, especially during the 1:00 hour on the day of the transition.

The clock advances like this:

...
00:59:58 EDT (-0400)
00:59:59 EDT (-0400)
01:00:00 EDT (-0400)   --+
01:00:01 EDT (-0400)     |--- 1st instance of 1:00 hour
...                      |
01:59:59 EDT (-0400)   --+
01:00:00 EST (-0500)   --+  <----  transition
01:00:01 EST (-0500)     |
...                      |--- 2nd instance of 1:00 hour
01:59:59 EST (-0500)   --+
02:00:00 EST (-0500)
02:00:01 EST (-0500)
...

Also keep in mind that when you set the time to 1:00 local time, you aren't being specific enough. Since there are two instances of 1:00, the OS will just pick one for you. On Linux and Mac OSX the underlying system clock is kept in UTC. 1:00 EDT is at 5:00 UTC, while 1:00 EST is at 6:00 UTC.

Restarting your machine should have no effect. My guess is that you didn't restart it right away, but allowed the time to elapse so it moved backward again.

Additional Info

Take a look at the man page for the date command. We can set the clock by the local time, using the somewhat strange format of [[[mm]dd]HH]MM[[cc]yy][.ss] So this is 1:00 local time on the day of the transition:

date 110301002013

But that is not very specific, so the OS is probably picking EDT because it's the first instance. It might as well pick EST though, since we didn't specify.

Instead, consider setting it by UTC:

date -u 110305002013       (1:00 EDT)

or

date -u 110306002013       (1:00 EST)
1

I'm not sure how date chooses its time-zone, but it can be over-ridden via the TZ environment variable. The difference in your two screen shots (before/after re-booting) is because date's default choice-of-time-zone got updated. All times were always correct; it's only an issue of how the underlying time got printed as a string.

Don't know if this helps get at the root of your confusion, but I've found it helpful:

EDT and EST are just two different time-zones, and they both exist all year long. Usually one changes the default time-zone only when traveling, but in some regions, people also change their default time-zone at certain moments. E.g. at 2013.Nov.03 05:59 GMT people on the east coast of U.S. tend to print times in EDT; at 2013.Nov.03 06:01 GMT they'll suddenly be printing all their dates in EST.

If somebody says "meet you at 14:30", you need to know what time-zone they're using to make it unambiguous. @Matt's answer clarifies how people interpret time zone, when it's not explicitly stated.

1
  • I like to think of EST and EDT as two segments of the same ET zone (America/New_York). And yes, some places do just stay on EST and never use EDT (ex: Cayman Islands). Your description is mostly accurate. The differences are just semantic. Not sure how changing TZ variable would help though. Nov 3, 2013 at 17:52
0

edt and est are the same zone except edt is for summer (daylight time) and est is for winter (standard time). as long as your clock reads the correct time, it doesn't really matter. also est doesn't start til 2am not 1am.

19
  • See my update in the attach question Nov 3, 2013 at 9:31
  • but the problem occur because of this every time I do Time.now(t1) is a ruby equivalent date unix library I give me EDT but the datetime field store in mysql is converted into correct timezone by ruby i.e EST (t2) and as result when I try to find difference of t1-t2 it return me negative value Nov 3, 2013 at 9:42
  • well if it is being corrected then what is the issue? how it got to be corrected doesn't matter if it is, right? I mean to say that if your clock is showing the correct time does it really matter if it says edt when you run Time.now. if mysql is correct then that is important because it is data. as long as it is either est or edt you are still in the et (eastern) time zone. Time.now may just not have updated itself to est yet because in screen shot you were at 1:13 am. est starts at 2 am.
    – jmc302005
    Nov 3, 2013 at 9:54
  • Well the problem is like This I this piece of code Time.now - (Some time from database) Time.now which is equivalent to date of unix is giving me EDT time and Database is giving me EST time as result I getting a Negative value See attached screesnhot Technically you cannot have negative value if you only inspect the time on each case see this and this to know what I meant Nov 3, 2013 at 14:23
  • ok so it seems that mysql is jumping the gun so to speak. EST starts at 2AM and mysql is in EST an hour early. that means there is some kind of time zone mistake with mysql and Time.now is in a different time zone. Eastern time zone is UTC-5:00 This is what shows on your mysql screen shot. Atlantic Time Zone is UTC-4:00 and that is what your Time.now is showing according to your mysql screen shot. That means you need to change your Time.now to the Eastern Time Zone UTC-5:00.
    – jmc302005
    Nov 3, 2013 at 14:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .