66 * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
77 *
88 * IDENTIFICATION
9- * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.15 2004/05/25 18:08:59 tgl Exp $
9+ * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.16 2004/05/25 19:46:21 tgl Exp $
1010 *
1111 *-------------------------------------------------------------------------
1212 */
@@ -163,7 +163,17 @@ try_timezone(const char *tzname, struct tztry *tt)
163163 return false; /* probably shouldn't happen */
164164 systm = localtime (& (tt -> test_times [i ]));
165165 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" );
166175 return false;
176+ }
167177 if (systm -> tm_isdst >= 0 )
168178 {
169179 /* Check match of zone names, too */
@@ -172,14 +182,23 @@ try_timezone(const char *tzname, struct tztry *tt)
172182 memset (cbuf , 0 , sizeof (cbuf ));
173183 strftime (cbuf , sizeof (cbuf ) - 1 , "%Z" , systm ); /* zone abbr */
174184 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 );
175189 return false;
190+ }
176191 }
177192 }
178193
179194 /* Reject if leap seconds involved */
180195 if (!tz_acceptable ())
196+ {
197+ elog (DEBUG4 , "Reject TZ \"%s\": uses leap seconds" , tzname );
181198 return false;
199+ }
182200
201+ elog (DEBUG4 , "Accept TZ \"%s\"" , tzname );
183202 return true;
184203}
185204
@@ -384,6 +403,13 @@ scan_available_timezones(char *tzdir, char *tzdirsub, struct tztry *tt)
384403 direntry = readdir (dirdesc );
385404 if (!direntry )
386405 {
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
387413 if (errno )
388414 ereport (LOG ,
389415 (errcode_for_file_access (),
0 commit comments