6
6
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
7
7
*
8
8
* IDENTIFICATION
9
- * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.15 2004/05/2518:08:59 tgl Exp $
9
+ * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.16 2004/05/2519:46:21 tgl Exp $
10
10
*
11
11
*-------------------------------------------------------------------------
12
12
*/
@@ -163,7 +163,17 @@ try_timezone(const char *tzname, struct tztry *tt)
163
163
return false;/* probably shouldn't happen */
164
164
systm = localtime (& (tt -> test_times [i ]));
165
165
if (!compare_tm (systm ,pgtm ))
166
+ {
167
+ elog (DEBUG4 ,"Reject TZ \"%s\": at %lu %04d-%02d-%02d %02d:%02d:%02d %s versus %04d-%02d-%02d %02d:%02d:%02d %s" ,
168
+ tzname , (unsigned long )tt -> test_times [i ],
169
+ pgtm -> tm_year + 1900 ,pgtm -> tm_mon + 1 ,pgtm -> tm_mday ,
170
+ pgtm -> tm_hour ,pgtm -> tm_min ,pgtm -> tm_sec ,
171
+ pgtm -> tm_isdst ?"dst" :"std" ,
172
+ systm -> tm_year + 1900 ,systm -> tm_mon + 1 ,systm -> tm_mday ,
173
+ systm -> tm_hour ,systm -> tm_min ,systm -> tm_sec ,
174
+ systm -> tm_isdst ?"dst" :"std" );
166
175
return false;
176
+ }
167
177
if (systm -> tm_isdst >=0 )
168
178
{
169
179
/* Check match of zone names, too */
@@ -172,14 +182,23 @@ try_timezone(const char *tzname, struct tztry *tt)
172
182
memset (cbuf ,0 ,sizeof (cbuf ));
173
183
strftime (cbuf ,sizeof (cbuf )- 1 ,"%Z" ,systm );/* zone abbr */
174
184
if (strcmp (TZABBREV (cbuf ),pgtm -> tm_zone )!= 0 )
185
+ {
186
+ elog (DEBUG4 ,"Reject TZ \"%s\": at %lu \"%s\" versus \"%s\"" ,
187
+ tzname , (unsigned long )tt -> test_times [i ],
188
+ pgtm -> tm_zone ,cbuf );
175
189
return false;
190
+ }
176
191
}
177
192
}
178
193
179
194
/* Reject if leap seconds involved */
180
195
if (!tz_acceptable ())
196
+ {
197
+ elog (DEBUG4 ,"Reject TZ \"%s\": uses leap seconds" ,tzname );
181
198
return false;
199
+ }
182
200
201
+ elog (DEBUG4 ,"Accept TZ \"%s\"" ,tzname );
183
202
return true;
184
203
}
185
204
@@ -384,6 +403,13 @@ scan_available_timezones(char *tzdir, char *tzdirsub, struct tztry *tt)
384
403
direntry = readdir (dirdesc );
385
404
if (!direntry )
386
405
{
406
+ #ifdef WIN32
407
+ /* This fix is in mingw cvs (runtime/mingwex/dirent.c rev 1.4),
408
+ * but not in released version
409
+ */
410
+ if (GetLastError ()== ERROR_NO_MORE_FILES )
411
+ errno = 0 ;
412
+ #endif
387
413
if (errno )
388
414
ereport (LOG ,
389
415
(errcode_for_file_access (),