diff options
author | Marc G. Fournier <scrappy@hub.org> | 1997-04-22 17:36:57 +0000 |
---|---|---|
committer | Marc G. Fournier <scrappy@hub.org> | 1997-04-22 17:36:57 +0000 |
commit | 7c82b2e9c3e2b0401a6c55d36b3cdcb778d2e531 (patch) | |
tree | b1d442e3ac7893516f5ce5d567aacdbfb6149d44 /src/backend/utils/adt/nabstime.c | |
parent | 9e2a87b62db87fc4175b00dabfd26293a2d072fa (diff) | |
download | postgresql-7c82b2e9c3e2b0401a6c55d36b3cdcb778d2e531.tar.gz |
From: Thomas Lockhart <Thomas.G.Lockhart@jpl.nasa.gov>
Subject: [PATCHES] date/time timezone patches (mail bounced?)
Here are some hacks to get timezone behavior for the various time
data types to be compatible with v6.0. Although we have some hooks
already installed to get timezone info from the client to the
server, it still isn't clear if that can correctly transfer enough
timezone info to make the behavior the same as if timezone info
were derived from the server as is now the case. We certainly
won't resolve it in a day, so I think we are stuck with server-only
timezones for v6.1.
Diffstat (limited to 'src/backend/utils/adt/nabstime.c')
-rw-r--r-- | src/backend/utils/adt/nabstime.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c index 2b912109c9..b227528ed3 100644 --- a/src/backend/utils/adt/nabstime.c +++ b/src/backend/utils/adt/nabstime.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.23 1997/04/15 17:46:52 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.24 1997/04/22 17:36:57 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -102,8 +102,16 @@ abstime2tm(AbsoluteTime time, int *tzp, struct tm *tm) { struct tm *tt; +#if FALSE if (tzp != NULL) time -= *tzp; tt = gmtime((time_t *) &time); +#endif + /* XXX HACK to get time behavior compatible with Postgres v6.0 - tgl 97/04/07 */ + if (tzp != NULL) { + tt = localtime((time_t *) &time); + } else { + tt = gmtime((time_t *) &time); + }; tm->tm_year = tt->tm_year+1900; tm->tm_mon = tt->tm_mon+1; @@ -160,7 +168,7 @@ tm2abstime( struct tm *tm, int tz) if (!AbsoluteTimeIsReal(sec)) return(INVALID_ABSTIME); - return sec; + return(sec); } /* tm2abstime() */ @@ -530,27 +538,27 @@ abstime_datetime(AbsoluteTime abstime) switch (abstime) { case INVALID_ABSTIME: - DATETIME_INVALID(*result); + DATETIME_INVALID(*result); break; case NOSTART_ABSTIME: - DATETIME_NOBEGIN(*result); + DATETIME_NOBEGIN(*result); break; case NOEND_ABSTIME: - DATETIME_NOEND(*result); + DATETIME_NOEND(*result); break; case EPOCH_ABSTIME: - DATETIME_EPOCH(*result); + DATETIME_EPOCH(*result); break; case CURRENT_ABSTIME: - DATETIME_CURRENT(*result); + DATETIME_CURRENT(*result); break; default: - *result = abstime + ((date2j( 1970, 1, 1) - date2j( 2000, 1, 1))*86400); + *result = abstime + ((date2j( 1970, 1, 1) - date2j( 2000, 1, 1))*86400); break; }; |