Subject Understanding time
Author willogibbo
Hi all

I am trying to understand the way time is stored in Firebird and how
to relate it to local time.

I see in documentation (e.g. Helen's book, page 150) that FB uses two
components for storing time, namely days from Nov 17, 1898 and ten
thousandths of seconds from midnight. I am right to presume that this
is done if effect on a GMT/UTC type basis, so that as FB stores a
date/time it takes the locale into account and makes the necessary
adjustment before it stores the time value, and then when the stored
value is retrieved it also takes the locale into account before display?

An example that illustrates, perhaps, why I raise this question is as
follows:

Say I have two TIMESTAMP fields LASTMODON and CREATEDON with times set
as both midday and dates as 27th and 26th March 2005 respectively. My
FB server is UNIX with a UK locale set. Because local time went from
GMT to BST between these dates the actual elapsed time difference
should be 23 hours (clocks went forward so an hour is "lost"). The
result of

select CAST(((LASTMODON - CREATEDON)*1440) AS INTEGER) as NEW_COL from
TABLENAME

however is 1440 minutes i.e. 24 hours not 23 hours.

I have seen a number of posts that ask questions about UTC, but there
seem to be few responses. Does this suggest that managing times as UTC
in FB is difficult / not possible?

Thanks in advance for any comments.
Will