7
7
*
8
8
*
9
9
* IDENTIFICATION
10
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.59 1998/10/08 18 :30:07 momjian Exp $
10
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.60 1998/12/31 16 :30:57 thomas Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -1454,11 +1454,12 @@ datetime_trunc(text *units, DateTime *datetime)
1454
1454
tm -> tm_year += 1900 ;
1455
1455
tm -> tm_mon += 1 ;
1456
1456
1457
- #ifdef HAVE_INT_TIMEZONE
1458
- tz = ((tm -> tm_isdst > 0 ) ? (timezone - 3600 ) : timezone );
1459
-
1460
- #else /* !HAVE_INT_TIMEZONE */
1457
+ #if defined(HAVE_TM_ZONE )
1461
1458
tz = - (tm -> tm_gmtoff ); /* tm_gmtoff is Sun/DEC-ism */
1459
+ #elif defined(HAVE_INT_TIMEZONE )
1460
+ tz = ((tm -> tm_isdst > 0 ) ? (timezone - 3600 ) : timezone );
1461
+ #else
1462
+ #error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined
1462
1463
#endif
1463
1464
1464
1465
#else /* !USE_POSIX_TIME */
@@ -2414,16 +2415,17 @@ datetime2tm(DateTime dt, int *tzp, struct tm * tm, double *fsec, char **tzn)
2414
2415
#ifdef USE_POSIX_TIME
2415
2416
tx = localtime (& utime );
2416
2417
#ifdef DATEDEBUG
2417
- #ifdef HAVE_INT_TIMEZONE
2418
+ #if defined(HAVE_TM_ZONE )
2419
+ printf ("datetime2tm- (localtime) %d.%02d.%02d %02d:%02d:%02.0f %s dst=%d\n" ,
2420
+ tx -> tm_year , tx -> tm_mon , tx -> tm_mday , tx -> tm_hour , tx -> tm_min , sec ,
2421
+ tx -> tm_zone , tx -> tm_isdst );
2422
+ #elif defined(HAVE_INT_TIMEZONE )
2418
2423
printf ("datetime2tm- (localtime) %d.%02d.%02d %02d:%02d:%02.0f %s %s dst=%d\n" ,
2419
2424
tx -> tm_year , tx -> tm_mon , tx -> tm_mday , tx -> tm_hour , tx -> tm_min , sec ,
2420
2425
tzname [0 ], tzname [1 ], tx -> tm_isdst );
2421
2426
#else
2422
- printf ("datetime2tm- (localtime) %d.%02d.%02d %02d:%02d:%02.0f %s dst=%d\n" ,
2423
- tx -> tm_year , tx -> tm_mon , tx -> tm_mday , tx -> tm_hour , tx -> tm_min , sec ,
2424
- tx -> tm_zone , tx -> tm_isdst );
2427
+ #error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined
2425
2428
#endif
2426
- #else
2427
2429
#endif
2428
2430
tm -> tm_year = tx -> tm_year + 1900 ;
2429
2431
tm -> tm_mon = tx -> tm_mon + 1 ;
@@ -2442,18 +2444,19 @@ datetime2tm(DateTime dt, int *tzp, struct tm * tm, double *fsec, char **tzn)
2442
2444
#endif
2443
2445
tm -> tm_isdst = tx -> tm_isdst ;
2444
2446
2445
- #ifdef HAVE_INT_TIMEZONE
2446
- * tzp = (tm -> tm_isdst ? (timezone - 3600 ) : timezone );
2447
- if (tzn != NULL )
2448
- * tzn = tzname [(tm -> tm_isdst > 0 )];
2449
-
2450
- #else /* !HAVE_INT_TIMEZONE */
2447
+ #if defined(HAVE_TM_ZONE )
2451
2448
tm -> tm_gmtoff = tx -> tm_gmtoff ;
2452
2449
tm -> tm_zone = tx -> tm_zone ;
2453
2450
2454
2451
* tzp = - (tm -> tm_gmtoff ); /* tm_gmtoff is Sun/DEC-ism */
2455
2452
if (tzn != NULL )
2456
- * tzn = tm -> tm_zone ;
2453
+ * tzn = (char * )tm -> tm_zone ;
2454
+ #elif defined(HAVE_INT_TIMEZONE )
2455
+ * tzp = (tm -> tm_isdst ? (timezone - 3600 ) : timezone );
2456
+ if (tzn != NULL )
2457
+ * tzn = tzname [(tm -> tm_isdst > 0 )];
2458
+ #else
2459
+ #error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined
2457
2460
#endif
2458
2461
2459
2462
#else /* !USE_POSIX_TIME */
@@ -2488,7 +2491,10 @@ datetime2tm(DateTime dt, int *tzp, struct tm * tm, double *fsec, char **tzn)
2488
2491
2489
2492
#ifdef DATEDEBUG
2490
2493
#ifdef USE_POSIX_TIME
2491
- #ifdef HAVE_INT_TIMEZONE
2494
+ #if defined(HAVE_TM_ZONE )
2495
+ printf ("datetime2tm- timezone is %s; offset is %d\n" ,
2496
+ tm -> tm_zone , ((tzp != NULL ) ? * tzp : 0 ));
2497
+ #elif defined(HAVE_INT_TIMEZONE )
2492
2498
printf ("datetime2tm- timezone is %s; offset is %d (%d); daylight is %d\n" ,
2493
2499
tzname [tm -> tm_isdst != 0 ], ((tzp != NULL ) ? * tzp : 0 ), CTimeZone , CDayLight );
2494
2500
#endif
@@ -3034,11 +3040,12 @@ DecodeDateTime(char **field, int *ftype, int nf,
3034
3040
tm -> tm_year += 1900 ;
3035
3041
tm -> tm_mon += 1 ;
3036
3042
3037
- #ifdef HAVE_INT_TIMEZONE
3038
- * tzp = ((tm -> tm_isdst > 0 ) ? (timezone - 3600 ) : timezone );
3039
-
3040
- #else /* !HAVE_INT_TIMEZONE */
3043
+ #if defined(HAVE_TM_ZONE )
3041
3044
* tzp = - (tm -> tm_gmtoff ); /* tm_gmtoff is Sun/DEC-ism */
3045
+ #elif defined(HAVE_INT_TIMEZONE )
3046
+ * tzp = ((tm -> tm_isdst > 0 ) ? (timezone - 3600 ) : timezone );
3047
+ #else
3048
+ #error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined
3042
3049
#endif
3043
3050
3044
3051
#else /* !USE_POSIX_TIME */
@@ -4104,12 +4111,14 @@ EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, cha
4104
4111
4105
4112
#ifdef DATEDEBUG
4106
4113
#ifdef USE_POSIX_TIME
4107
- #ifdef HAVE_INT_TIMEZONE
4114
+ #if defined(HAVE_TM_ZONE )
4115
+ printf ("EncodeDateTime- timezone is %s (%s); offset is %ld (%d); daylight is %d (%d)\n" ,
4116
+ * tzn , tm -> tm_zone , (- tm -> tm_gmtoff ), CTimeZone , tm -> tm_isdst , CDayLight );
4117
+ #elif defined(HAVE_INT_TIMEZONE )
4108
4118
printf ("EncodeDateTime- timezone is %s (%s); offset is %d (%d); daylight is %d (%d)\n" ,
4109
4119
* tzn , tzname [0 ], * tzp , CTimeZone , tm -> tm_isdst , CDayLight );
4110
4120
#else
4111
- printf ("EncodeDateTime- timezone is %s (%s); offset is %ld (%d); daylight is %d (%d)\n" ,
4112
- * tzn , tm -> tm_zone , (- tm -> tm_gmtoff ), CTimeZone , tm -> tm_isdst , CDayLight );
4121
+ #error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined
4113
4122
#endif
4114
4123
#else
4115
4124
printf ("EncodeDateTime- timezone is %s (%s); offset is %d; daylight is %d\n" ,
0 commit comments