Re: Daylight savings time confusion

From: Justin Graf <justin(at)magwerks(dot)com>
To: Rob Richardson <Rob(dot)Richardson(at)rad-con(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Daylight savings time confusion
Date: 2010-03-15 20:45:35
Message-ID: 4B9E9C6F.1090508@magwerks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/15/2010 2:40 PM, Rob Richardson wrote:
> Greetings!
>
> Our database monitors the progression of steel coils through the
> annealing process. The times for each step are recorded in wallclock
> time (US eastern time zone for this customer) and in UTC time. During
> standard time, the difference will be 5 hours, and during daylight
> savings time the difference will be 4 hours.
>
> I just looked at the record for a charge for which heating started just
> after 9:00 Saturday night, less than 3 hours before the change to
> daylight savings time. The UTC time stored for this event is six hours
> later!
>
> The function that writes these times first stores the UTC time in a
> variable named UTCTimestamp:
>
> select into UTCTimestamp current_timestamp at time zone 'UTC';
>
> Then, later in the function, the two times get written into the record
> (along with some other stuff):
>
> update charge set
> status=ChargeStatus,fire_date=current_timestamp,
> fire_date_utc=UTCTimestamp, fire_user=FurnaceTender,
> updated_by=UserId,updated_date=current_timestamp where charge=ChargeNum;
>
> Can someone explain why fire_date is 2010-03-13 21:39:51.744 and
> fire_date_utc is 2010-03-14 03:39:51.744 for this record?
>
> There is another charge that began firing five and a half hours before
> the DST switch. The difference between its fire_date and fire_date_utc
> times is five hours, as expected.
>
> RobR
>

My first thought is the server is using libraries that don't know the
DST was brought forward 3 weeks earlier than last year, its clock is
all confused.

i would check the time on Postgresql Server making sure it read out
correctly. below was run on pg 8.4 windows 2008 server

Select current_timestamp, current_timestamp at time zone 'UTC';
"2010-03-15 16:43:11.382-04";"2010-03-15 20:43:11.382"

All legitimate Magwerks Corporation quotations are sent in a .PDF file attachment with a unique ID number generated by our proprietary quotation system. Quotations received via any other form of communication will not be honored.

CONFIDENTIALITY NOTICE: This e-mail, including attachments, may contain legally privileged, confidential or other information proprietary to Magwerks Corporation and is intended solely for the use of the individual to whom it addresses. If the reader of this e-mail is not the intended recipient or authorized agent, the reader is hereby notified that any unauthorized viewing, dissemination, distribution or copying of this e-mail is strictly prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and destroy all occurrences of this e-mail immediately.
Thank you.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rob Richardson 2010-03-15 20:51:47 Re: Daylight savings time confusion
Previous Message Arnold, Sandra 2010-03-15 20:40:40 FW: 8.4.2 One Click Installer