Commit 28454c21 authored by Marc G. Fournier's avatar Marc G. Fournier

From: Thomas Lockhart <Thomas.G.Lockhart@jpl.nasa.gov>

Subject: Re: [HACKERS] abstime "now" broken

Yes, I broke 'now' :( with an attempt at a bug fix involving
servers running in the UTC/GMT timezone. These patches fix
the problem, and have been tested in GMT (+00 hours),
PST (-08), and NZT (+12) timezones which exercized the code for
various cases including across day boundaries.  btw, this code
fixes the same type of problem for 'today', 'yesterday', 'tomorrow',
for DATETIME, ABSTIME, DATE and TIME types.

The bugfix itself is quite small, but I have accumulated other
changes in the datetime data type and include them here also.
One set of changes involves printing ISO-formatted dates and
is in response to the helpful information from Kurt Lidl regarding
ANSI SQL dates. I'll send another e-mail sometime soon discussing
more issues he has raised...
parent 159f8c63
This diff is collapsed.
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.20 1997/03/28 06:54:51 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.21 1997/03/28 07:12:53 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -93,7 +93,7 @@ GetCurrentTime(struct tm *tm)
time_t now;
struct tm *tt;
now = GetCurrentTransactionStartTime();
now = GetCurrentTransactionStartTime()-CTimeZone;
tt = gmtime( &now);
tm->tm_year = tt->tm_year+1900;
......
......@@ -8,7 +8,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: dt.h,v 1.3 1997/03/25 08:11:18 scrappy Exp $
* $Id: dt.h,v 1.4 1997/03/28 07:13:21 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -306,8 +306,8 @@ extern int DecodeDateDelta( char *field[], int ftype[],
extern int DecodeUnits(int field, char *lowtoken, int *val);
extern int EncodeSpecialDateTime(DateTime dt, char *str);
extern int EncodePostgresDate(struct tm *tm, double fsec, char *str);
extern int EncodePostgresSpan(struct tm *tm, double fsec, char *str);
extern int EncodeDateTime(struct tm *tm, double fsec, int style, char *str);
extern int EncodeTimeSpan(struct tm *tm, double fsec, int style, char *str);
extern datetkn *datebsearch(char *key, datetkn *base, unsigned int nel);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment