mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-23 22:47:19 +02:00
Subject: [HACKERS] backend/utils/adt/timestamp.c Back to this timezone stuff. The struct tm has a field (tm_gmtoff) which is the offset from UTC (GMT is archaic BTW) in seconds. Is this the value you are looking for when you use timezone? Note that this applies to NetBSD but it does not appear to be in either ANSI C or POSIX. This looks like one of those things that is just going to have to be hand coded for each platform. Why not just store the values in UTC and use localtime instead of gmtime when retrieving the value? Also, you assume the time is returned as a 4 byte integer. In fact, there is not even any requirement that time be an integral value. You should use time_t here. The input function seems unduly restrictive. Somewhere in the sources there is an input function that allows words for months. Can't we do the same here? There is a standard function, difftime, for subtracting two times. It deals with cases where time_t is not integral. There is, however, a small performance hit since it returns a double and I don't believe there is any system currently which uses anything but an integral for time_t. Still, this is technically the correct and portable thing to do. The returns from the various comparisons should probably be a bool. |
||
---|---|---|
.. | ||
access | ||
bootstrap | ||
catalog | ||
commands | ||
executor | ||
lib | ||
libpq | ||
main | ||
nodes | ||
optimizer | ||
parser | ||
port | ||
postmaster | ||
regex | ||
rewrite | ||
storage | ||
tcop | ||
tioga | ||
utils | ||
Makefile |