Subject Re: NOW and Daylight Saving Time
Author Adam
--- In, Stefan Heymann <lists@...> wrote:
> Hi,
> I am writing a measurement data acquisition application which stores
> the data, together with a timestamp, in a (you guess it) Firebird
> database.
> Currently I use "NOW" to set the timestamp. This gives me the current
> local time of the server machine that Firebird is running on.
> insert into table (..., datetime, ...) values (..., 'NOW', ...);
> When Daylight Saving Time over here in Germany will end at 29 October
> this year, the hour between 2:00 a.m. and 3:00 a.m. will run twice.
> This would result in ambiguous timestamps.
> Is there a means to distinguish the two "time zones"? Or a way to
> retrieve GMT time (of course, without reconfiguring the server OS)
> instead of the local time? I'd like to have the server give the
> timestamp so I don't have to rely on workstation clocks being set
> properly.


It is even more fun when your country has different Timezone and DST
rules depending on which state. I think a built in function
CURRENT_TIMESTAMPUTC and NOWUTC would be a welcome addition.

The easiest way to do it is to write a UDF function. Since you use
Delphi, here is some starter code for Windows. You just need to modify
it to output a timestamp for Firebird.

SysUtils, Windows;

function GetSystemTime : TDateTime;
Result := SystemTimeToDateTime(st);