summaryrefslogtreecommitdiff
path: root/src/timezone
diff options
context:
space:
mode:
authorBruce Momjian2004-08-29 05:07:03 +0000
committerBruce Momjian2004-08-29 05:07:03 +0000
commitb6b71b85bc45b49005b5aec87cba2c33fc8baf49 (patch)
treec23dbd1dbc43972a8e48327c8a771baf36952f3d /src/timezone
parent90cb9c305140684b2b00c739b724f67915e11404 (diff)
Pgindent run for 8.0.
Diffstat (limited to 'src/timezone')
-rw-r--r--src/timezone/localtime.c59
-rw-r--r--src/timezone/pgtz.c587
-rw-r--r--src/timezone/private.h3
-rw-r--r--src/timezone/strftime.c53
-rw-r--r--src/timezone/zic.c56
5 files changed, 464 insertions, 294 deletions
diff --git a/src/timezone/localtime.c b/src/timezone/localtime.c
index 61c58d05e7a..5cd0b41ed29 100644
--- a/src/timezone/localtime.c
+++ b/src/timezone/localtime.c
@@ -3,7 +3,7 @@
* 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/timezone/localtime.c,v 1.7 2004/06/03 02:08:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/timezone/localtime.c,v 1.8 2004/08/29 05:07:02 momjian Exp $
*/
/*
@@ -117,9 +117,9 @@ static void gmtload(struct state * sp);
static void gmtsub(const pg_time_t *timep, long offset, struct pg_tm * tmp);
static void localsub(const pg_time_t *timep, long offset, struct pg_tm * tmp);
static void timesub(const pg_time_t *timep, long offset,
- const struct state * sp, struct pg_tm * tmp);
+ const struct state * sp, struct pg_tm * tmp);
static pg_time_t transtime(pg_time_t janfirst, int year,
- const struct rule * rulep, long offset);
+ const struct rule * rulep, long offset);
static int tzload(const char *name, struct state * sp);
static int tzparse(const char *name, struct state * sp, int lastditch);
@@ -370,9 +370,8 @@ getsecs(register const char *strp, long *secsp)
/*
* `HOURSPERDAY * DAYSPERWEEK - 1' allows quasi-Posix rules like
- * "M10.4.6/26", which does not conform to Posix, but which
- * specifies the equivalent of ``02:00 on the first Sunday on or
- * after 23 Oct''.
+ * "M10.4.6/26", which does not conform to Posix, but which specifies
+ * the equivalent of ``02:00 on the first Sunday on or after 23 Oct''.
*/
strp = getnum(strp, &num, 0, HOURSPERDAY * DAYSPERWEEK - 1);
if (strp == NULL)
@@ -512,10 +511,10 @@ transtime(const pg_time_t janfirst, const int year,
case JULIAN_DAY:
/*
- * Jn - Julian day, 1 == January 1, 60 == March 1 even in
- * leap years. In non-leap years, or if the day number is
- * 59 or less, just add SECSPERDAY times the day number-1 to
- * the time of January 1, midnight, to get the day.
+ * Jn - Julian day, 1 == January 1, 60 == March 1 even in leap
+ * years. In non-leap years, or if the day number is 59 or
+ * less, just add SECSPERDAY times the day number-1 to the
+ * time of January 1, midnight, to get the day.
*/
value = janfirst + (rulep->r_day - 1) * SECSPERDAY;
if (leapyear && rulep->r_day >= 60)
@@ -525,9 +524,8 @@ transtime(const pg_time_t janfirst, const int year,
case DAY_OF_YEAR:
/*
- * n - day of year. Just add SECSPERDAY times the day
- * number to the time of January 1, midnight, to get the
- * day.
+ * n - day of year. Just add SECSPERDAY times the day number
+ * to the time of January 1, midnight, to get the day.
*/
value = janfirst + rulep->r_day * SECSPERDAY;
break;
@@ -542,8 +540,8 @@ transtime(const pg_time_t janfirst, const int year,
value += mon_lengths[leapyear][i] * SECSPERDAY;
/*
- * Use Zeller's Congruence to get day-of-week of first day
- * of month.
+ * Use Zeller's Congruence to get day-of-week of first day of
+ * month.
*/
m1 = (rulep->r_mon + 9) % 12 + 1;
yy0 = (rulep->r_mon <= 2) ? (year - 1) : year;
@@ -555,9 +553,9 @@ transtime(const pg_time_t janfirst, const int year,
dow += DAYSPERWEEK;
/*
- * "dow" is the day-of-week of the first day of the month.
- * Get the day-of-month (zero-origin) of the first "dow" day
- * of the month.
+ * "dow" is the day-of-week of the first day of the month. Get
+ * the day-of-month (zero-origin) of the first "dow" day of
+ * the month.
*/
d = rulep->r_day - dow;
if (d < 0)
@@ -652,8 +650,8 @@ tzparse(const char *name, register struct state * sp, const int lastditch)
struct rule end;
register int year;
register pg_time_t janfirst;
- pg_time_t starttime;
- pg_time_t endtime;
+ pg_time_t starttime;
+ pg_time_t endtime;
++name;
if ((name = getrule(name, &start)) == NULL)
@@ -750,8 +748,8 @@ tzparse(const char *name, register struct state * sp, const int lastditch)
theiroffset = theirstdoffset;
/*
- * Now juggle transition times and types tracking offsets
- * as you do.
+ * Now juggle transition times and types tracking offsets as
+ * you do.
*/
for (i = 0; i < sp->timecnt; ++i)
{
@@ -929,8 +927,8 @@ gmtsub(const pg_time_t *timep, const long offset, struct pg_tm * tmp)
timesub(timep, offset, gmtptr, tmp);
/*
- * Could get fancy here and deliver something such as "UTC+xxxx"
- * or "UTC-xxxx" if offset is non-zero, but this is no time for a
+ * Could get fancy here and deliver something such as "UTC+xxxx" or
+ * "UTC-xxxx" if offset is non-zero, but this is no time for a
* treasure hunt.
*/
if (offset != 0)
@@ -952,6 +950,7 @@ timesub(const pg_time_t *timep, const long offset,
register const struct state * sp, register struct pg_tm * tmp)
{
register const struct lsinfo *lp;
+
/* expand days to 64 bits to support full Julian-day range */
register int64 days;
register int idays;
@@ -1026,12 +1025,14 @@ timesub(const pg_time_t *timep, const long offset,
if (tmp->tm_wday < 0)
tmp->tm_wday += DAYSPERWEEK;
y = EPOCH_YEAR;
+
/*
- * Note: the point of adding 4800 is to ensure we make the same assumptions
- * as Postgres' Julian-date routines about the placement of leap years
- * in centuries BC, at least back to 4713BC which is as far as we'll go.
- * This is effectively extending Gregorian timekeeping into pre-Gregorian
- * centuries, which is a tad bogus but it conforms to the SQL spec...
+ * Note: the point of adding 4800 is to ensure we make the same
+ * assumptions as Postgres' Julian-date routines about the placement
+ * of leap years in centuries BC, at least back to 4713BC which is as
+ * far as we'll go. This is effectively extending Gregorian
+ * timekeeping into pre-Gregorian centuries, which is a tad bogus but
+ * it conforms to the SQL spec...
*/
#define LEAPS_THRU_END_OF(y) (((y) + 4800) / 4 - ((y) + 4800) / 100 + ((y) + 4800) / 400)
while (days < 0 || days >= (int64) year_lengths[yleap = isleap(y)])
diff --git a/src/timezone/pgtz.c b/src/timezone/pgtz.c
index fdc00b6ceed..4a44a098a9d 100644
--- a/src/timezone/pgtz.c
+++ b/src/timezone/pgtz.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.22 2004/08/29 04:13:12 momjian Exp $
+ * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.23 2004/08/29 05:07:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -71,10 +71,10 @@ pg_TZDIR(void)
#ifndef WIN32
#define T_DAY ((time_t) (60*60*24))
-#define T_WEEK ((time_t) (60*60*24*7))
+#define T_WEEK ((time_t) (60*60*24*7))
#define T_MONTH ((time_t) (60*60*24*31))
-#define MAX_TEST_TIMES (52*100) /* 100 years, or 1904..2004 */
+#define MAX_TEST_TIMES (52*100) /* 100 years, or 1904..2004 */
struct tztry
{
@@ -83,15 +83,15 @@ struct tztry
};
static void scan_available_timezones(char *tzdir, char *tzdirsub,
- struct tztry *tt,
- int *bestscore, char *bestzonename);
+ struct tztry * tt,
+ int *bestscore, char *bestzonename);
/*
* Get GMT offset from a system struct tm
*/
static int
-get_timezone_offset(struct tm *tm)
+get_timezone_offset(struct tm * tm)
{
#if defined(HAVE_STRUCT_TM_TM_ZONE)
return tm->tm_gmtoff;
@@ -126,7 +126,7 @@ build_time_t(int year, int month, int day)
* Does a system tm value match one we computed ourselves?
*/
static bool
-compare_tm(struct tm *s, struct pg_tm *p)
+compare_tm(struct tm * s, struct pg_tm * p)
{
if (s->tm_sec != p->tm_sec ||
s->tm_min != p->tm_min ||
@@ -153,12 +153,12 @@ compare_tm(struct tm *s, struct pg_tm *p)
* test time.
*/
static int
-score_timezone(const char *tzname, struct tztry *tt)
+score_timezone(const char *tzname, struct tztry * tt)
{
int i;
pg_time_t pgtt;
- struct tm *systm;
- struct pg_tm *pgtm;
+ struct tm *systm;
+ struct pg_tm *pgtm;
char cbuf[TZ_STRLEN_MAX + 1];
if (!pg_tzset(tzname))
@@ -177,7 +177,7 @@ score_timezone(const char *tzname, struct tztry *tt)
pgtt = (pg_time_t) (tt->test_times[i]);
pgtm = pg_localtime(&pgtt);
if (!pgtm)
- return -1; /* probably shouldn't happen */
+ return -1; /* probably shouldn't happen */
systm = localtime(&(tt->test_times[i]));
if (!systm)
{
@@ -206,7 +206,7 @@ score_timezone(const char *tzname, struct tztry *tt)
if (pgtm->tm_zone == NULL)
return -1; /* probably shouldn't happen */
memset(cbuf, 0, sizeof(cbuf));
- strftime(cbuf, sizeof(cbuf) - 1, "%Z", systm); /* zone abbr */
+ strftime(cbuf, sizeof(cbuf) - 1, "%Z", systm); /* zone abbr */
if (strcmp(cbuf, pgtm->tm_zone) != 0)
{
elog(DEBUG4, "TZ \"%s\" scores %d: at %ld \"%s\" versus \"%s\"",
@@ -249,18 +249,19 @@ identify_system_timezone(void)
/*
* Set up the list of dates to be probed to see how well our timezone
* matches the system zone. We first probe January and July of 2004;
- * this serves to quickly eliminate the vast majority of the TZ database
- * entries. If those dates match, we probe every week from 2004 backwards
- * to late 1904. (Weekly resolution is good enough to identify DST
- * transition rules, since everybody switches on Sundays.) The further
- * back the zone matches, the better we score it. This may seem like
- * a rather random way of doing things, but experience has shown that
- * system-supplied timezone definitions are likely to have DST behavior
- * that is right for the recent past and not so accurate further back.
- * Scoring in this way allows us to recognize zones that have some
- * commonality with the zic database, without insisting on exact match.
- * (Note: we probe Thursdays, not Sundays, to avoid triggering
- * DST-transition bugs in localtime itself.)
+ * this serves to quickly eliminate the vast majority of the TZ
+ * database entries. If those dates match, we probe every week from
+ * 2004 backwards to late 1904. (Weekly resolution is good enough to
+ * identify DST transition rules, since everybody switches on
+ * Sundays.) The further back the zone matches, the better we score
+ * it. This may seem like a rather random way of doing things, but
+ * experience has shown that system-supplied timezone definitions are
+ * likely to have DST behavior that is right for the recent past and
+ * not so accurate further back. Scoring in this way allows us to
+ * recognize zones that have some commonality with the zic database,
+ * without insisting on exact match. (Note: we probe Thursdays, not
+ * Sundays, to avoid triggering DST-transition bugs in localtime
+ * itself.)
*/
tt.n_test_times = 0;
tt.test_times[tt.n_test_times++] = build_time_t(2004, 1, 15);
@@ -282,12 +283,12 @@ identify_system_timezone(void)
return resultbuf;
/*
- * Couldn't find a match in the database, so next we try constructed zone
- * names (like "PST8PDT").
+ * Couldn't find a match in the database, so next we try constructed
+ * zone names (like "PST8PDT").
*
- * First we need to determine the names of the local standard and daylight
- * zones. The idea here is to scan forward from today until we have
- * seen both zones, if both are in use.
+ * First we need to determine the names of the local standard and
+ * daylight zones. The idea here is to scan forward from today until
+ * we have seen both zones, if both are in use.
*/
memset(std_zone_name, 0, sizeof(std_zone_name));
memset(dst_zone_name, 0, sizeof(dst_zone_name));
@@ -363,18 +364,19 @@ identify_system_timezone(void)
return resultbuf;
/*
- * Did not find the timezone. Fallback to use a GMT zone. Note that the
- * zic timezone database names the GMT-offset zones in POSIX style: plus
- * is west of Greenwich. It's unfortunate that this is opposite of SQL
- * conventions. Should we therefore change the names? Probably not...
+ * Did not find the timezone. Fallback to use a GMT zone. Note that
+ * the zic timezone database names the GMT-offset zones in POSIX
+ * style: plus is west of Greenwich. It's unfortunate that this is
+ * opposite of SQL conventions. Should we therefore change the names?
+ * Probably not...
*/
snprintf(resultbuf, sizeof(resultbuf), "Etc/GMT%s%d",
- (-std_ofs > 0) ? "+" : "", -std_ofs / 3600);
+ (-std_ofs > 0) ? "+" : "", -std_ofs / 3600);
ereport(LOG,
- (errmsg("could not recognize system timezone, defaulting to \"%s\"",
- resultbuf),
- errhint("You can specify the correct timezone in postgresql.conf.")));
+ (errmsg("could not recognize system timezone, defaulting to \"%s\"",
+ resultbuf),
+ errhint("You can specify the correct timezone in postgresql.conf.")));
return resultbuf;
}
@@ -382,7 +384,7 @@ identify_system_timezone(void)
* Recursively scan the timezone database looking for the best match to
* the system timezone behavior.
*
- * tzdir points to a buffer of size MAXPGPATH. On entry, it holds the
+ * tzdir points to a buffer of size MAXPGPATH. On entry, it holds the
* pathname of a directory containing TZ files. We internally modify it
* to hold pathnames of sub-directories and files, but must restore it
* to its original contents before exit.
@@ -398,7 +400,7 @@ identify_system_timezone(void)
* score. bestzonename must be a buffer of length TZ_STRLEN_MAX + 1.
*/
static void
-scan_available_timezones(char *tzdir, char *tzdirsub, struct tztry *tt,
+scan_available_timezones(char *tzdir, char *tzdirsub, struct tztry * tt,
int *bestscore, char *bestzonename)
{
int tzdir_orig_len = strlen(tzdir);
@@ -453,7 +455,7 @@ scan_available_timezones(char *tzdir, char *tzdirsub, struct tztry *tt,
else
{
/* Load and test this file */
- int score = score_timezone(tzdirsub, tt);
+ int score = score_timezone(tzdirsub, tt);
if (score > *bestscore)
{
@@ -477,181 +479,351 @@ scan_available_timezones(char *tzdir, char *tzdirsub, struct tztry *tt,
tzdir[tzdir_orig_len] = '\0';
}
-#else /* WIN32 */
+#else /* WIN32 */
-static const struct {
- const char *stdname; /* Windows name of standard timezone */
- const char *dstname; /* Windows name of daylight timezone */
- const char *pgtzname; /* Name of pgsql timezone to map to */
-} win32_tzmap[] = {
+static const struct
+{
+ const char *stdname; /* Windows name of standard timezone */
+ const char *dstname; /* Windows name of daylight timezone */
+ const char *pgtzname; /* Name of pgsql timezone to map to */
+} win32_tzmap[] =
+
+{
/*
* This list was built from the contents of the registry at
- * HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones
- * on Windows XP Professional SP1
+ * HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
+ * NT\CurrentVersion\Time Zones on Windows XP Professional SP1
*
* The zones have been matched to zic timezones by looking at the cities
- * listed in the win32 display name (in the comment here) in most cases.
+ * listed in the win32 display name (in the comment here) in most
+ * cases.
*/
- {"Afghanistan Standard Time", "Afghanistan Daylight Time",
- "Asia/Kabul"}, /* (GMT+04:30) Kabul */
- {"Alaskan Standard Time", "Alaskan Daylight Time",
- "US/Alaska"}, /* (GMT-09:00) Alaska */
- {"Arab Standard Time", "Arab Daylight Time",
- "Asia/Kuwait"}, /* (GMT+03:00) Kuwait, Riyadh */
- {"Arabian Standard Time", "Arabian Daylight Time",
- "Asia/Muscat"}, /* (GMT+04:00) Abu Dhabi, Muscat */
- {"Arabic Standard Time", "Arabic Daylight Time",
- "Asia/Baghdad"}, /* (GMT+03:00) Baghdad */
- {"Atlantic Standard Time", "Atlantic Daylight Time",
- "Canada/Atlantic"}, /* (GMT-04:00) Atlantic Time (Canada) */
- {"AUS Central Standard Time", "AUS Central Daylight Time",
- "Australia/Darwin"}, /* (GMT+09:30) Darwin */
- {"AUS Eastern Standard Time", "AUS Eastern Daylight Time",
- "Australia/Canberra"}, /* (GMT+10:00) Canberra, Melbourne, Sydney */
- {"Azores Standard Time", "Azores Daylight Time",
- "Atlantic/Azores"}, /* (GMT-01:00) Azores */
- {"Canada Central Standard Time", "Canada Central Daylight Time",
- "Canada/Saskatchewan"}, /* (GMT-06:00) Saskatchewan */
- {"Cape Verde Standard Time", "Cape Verde Daylight Time",
- "Atlantic/Cape_Verde"}, /* (GMT-01:00) Cape Verde Is. */
- {"Caucasus Standard Time", "Caucasus Daylight Time",
- "Asia/Baku"}, /* (GMT+04:00) Baku, Tbilisi, Yerevan */
- {"Cen. Australia Standard Time", "Cen. Australia Daylight Time",
- "Australia/Adelaide"}, /* (GMT+09:30) Adelaide */
- {"Central America Standard Time", "Central America Daylight Time",
- "CST6CDT"}, /* (GMT-06:00) Central America */
- {"Central Asia Standard Time", "Central Asia Daylight Time",
- "Asia/Dhaka"}, /* (GMT+06:00) Astana, Dhaka */
- {"Central Europe Standard Time", "Central Europe Daylight Time",
- "Europe/Belgrade"}, /* (GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague */
- {"Central European Standard Time", "Central European Daylight Time",
- "Europe/Sarajevo"}, /* (GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb */
- {"Central Pacific Standard Time", "Central Pacific Daylight Time",
- "Pacific/Noumea"}, /* (GMT+11:00) Magadan, Solomon Is., New Caledonia */
- {"Central Standard Time", "Central Daylight Time",
- "US/Central"}, /* (GMT-06:00) Central Time (US & Canada) */
- {"China Standard Time", "China Daylight Time",
- "Asia/Hong_Kong"}, /* (GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi */
- {"Dateline Standard Time", "Dateline Daylight Time",
- "Etc/GMT+12"}, /* (GMT-12:00) International Date Line West */
- {"E. Africa Standard Time", "E. Africa Daylight Time",
- "Africa/Nairobi"}, /* (GMT+03:00) Nairobi */
- {"E. Australia Standard Time", "E. Australia Daylight Time",
- "Australia/Brisbane"}, /* (GMT+10:00) Brisbane */
- {"E. Europe Standard Time", "E. Europe Daylight Time",
- "Europe/Bucharest"}, /* (GMT+02:00) Bucharest */
- {"E. South America Standard Time", "E. South America Daylight Time",
- "America/Araguaina"}, /* (GMT-03:00) Brasilia */
- {"Eastern Standard Time", "Eastern Daylight Time",
- "US/Eastern"}, /* (GMT-05:00) Eastern Time (US & Canada) */
- {"Egypt Standard Time", "Egypt Daylight Time",
- "Africa/Cairo"}, /* (GMT+02:00) Cairo */
- {"Ekaterinburg Standard Time", "Ekaterinburg Daylight Time",
- "Asia/Yekaterinburg"}, /* (GMT+05:00) Ekaterinburg */
- {"Fiji Standard Time", "Fiji Daylight Time",
- "Pacific/Fiji"}, /* (GMT+12:00) Fiji, Kamchatka, Marshall Is. */
- {"FLE Standard Time", "FLE Daylight Time",
- "Europe/Helsinki"}, /* (GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius */
- {"GMT Standard Time", "GMT Daylight Time",
- "Europe/Dublin"}, /* (GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London */
- {"Greenland Standard Time", "Greenland Daylight Time",
- "America/Godthab"}, /* (GMT-03:00) Greenland */
- {"Greenwich Standard Time", "Greenwich Daylight Time",
- "Africa/Casablanca"}, /* (GMT) Casablanca, Monrovia */
- {"GTB Standard Time", "GTB Daylight Time",
- "Europe/Athens"}, /* (GMT+02:00) Athens, Istanbul, Minsk */
- {"Hawaiian Standard Time", "Hawaiian Daylight Time",
- "US/Hawaii"}, /* (GMT-10:00) Hawaii */
- {"India Standard Time", "India Daylight Time",
- "Asia/Calcutta"}, /* (GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi */
- {"Iran Standard Time", "Iran Daylight Time",
- "Asia/Tehran"}, /* (GMT+03:30) Tehran */
- {"Jerusalem Standard Time", "Jerusalem Daylight Time",
- "Asia/Jerusalem"}, /* (GMT+02:00) Jerusalem */
- {"Korea Standard Time", "Korea Daylight Time",
- "Asia/Seoul"}, /* (GMT+09:00) Seoul */
- {"Mexico Standard Time", "Mexico Daylight Time",
- "America/Mexico_City"}, /* (GMT-06:00) Guadalajara, Mexico City, Monterrey */
- {"Mexico Standard Time", "Mexico Daylight Time",
- "America/La_Paz"}, /* (GMT-07:00) Chihuahua, La Paz, Mazatlan */
- {"Mid-Atlantic Standard Time", "Mid-Atlantic Daylight Time",
- "Atlantic/South_Georgia"}, /* (GMT-02:00) Mid-Atlantic */
- {"Mountain Standard Time", "Mountain Daylight Time",
- "US/Mountain"}, /* (GMT-07:00) Mountain Time (US & Canada) */
- {"Myanmar Standard Time", "Myanmar Daylight Time",
- "Asia/Rangoon"}, /* (GMT+06:30) Rangoon */
- {"N. Central Asia Standard Time", "N. Central Asia Daylight Time",
- "Asia/Almaty"}, /* (GMT+06:00) Almaty, Novosibirsk */
- {"Nepal Standard Time", "Nepal Daylight Time",
- "Asia/Katmandu"}, /* (GMT+05:45) Kathmandu */
- {"New Zealand Standard Time", "New Zealand Daylight Time",
- "Pacific/Auckland"}, /* (GMT+12:00) Auckland, Wellington */
- {"Newfoundland Standard Time", "Newfoundland Daylight Time",
- "Canada/Newfoundland"}, /* (GMT-03:30) Newfoundland */
- {"North Asia East Standard Time", "North Asia East Daylight Time",
- "Asia/Irkutsk"}, /* (GMT+08:00) Irkutsk, Ulaan Bataar */
- {"North Asia Standard Time", "North Asia Daylight Time",
- "Asia/Krasnoyarsk"}, /* (GMT+07:00) Krasnoyarsk */
- {"Pacific SA Standard Time", "Pacific SA Daylight Time",
- "America/Santiago"}, /* (GMT-04:00) Santiago */
- {"Pacific Standard Time", "Pacific Daylight Time",
- "US/Pacific"}, /* (GMT-08:00) Pacific Time (US & Canada); Tijuana */
- {"Romance Standard Time", "Romance Daylight Time",
- "Europe/Brussels"}, /* (GMT+01:00) Brussels, Copenhagen, Madrid, Paris */
- {"Russian Standard Time", "Russian Daylight Time",
- "Europe/Moscow"}, /* (GMT+03:00) Moscow, St. Petersburg, Volgograd */
- {"SA Eastern Standard Time", "SA Eastern Daylight Time",
- "America/Buenos_Aires"}, /* (GMT-03:00) Buenos Aires, Georgetown */
- {"SA Pacific Standard Time", "SA Pacific Daylight Time",
- "America/Bogota"}, /* (GMT-05:00) Bogota, Lima, Quito */
- {"SA Western Standard Time", "SA Western Daylight Time",
- "America/Caracas"}, /* (GMT-04:00) Caracas, La Paz */
- {"Samoa Standard Time", "Samoa Daylight Time",
- "Pacific/Midway"}, /* (GMT-11:00) Midway Island, Samoa */
- {"SE Asia Standard Time", "SE Asia Daylight Time",
- "Asia/Bangkok"}, /* (GMT+07:00) Bangkok, Hanoi, Jakarta */
- {"Malay Peninsula Standard Time", "Malay Peninsula Daylight Time",
- "Asia/Kuala_Lumpur"}, /* (GMT+08:00) Kuala Lumpur, Singapore */
- {"South Africa Standard Time", "South Africa Daylight Time",
- "Africa/Harare"}, /* (GMT+02:00) Harare, Pretoria */
- {"Sri Lanka Standard Time", "Sri Lanka Daylight Time",
- "Asia/Colombo"}, /* (GMT+06:00) Sri Jayawardenepura */
- {"Taipei Standard Time", "Taipei Daylight Time",
- "Asia/Taipei"}, /* (GMT+08:00) Taipei */
- {"Tasmania Standard Time", "Tasmania Daylight Time",
- "Australia/Hobart"}, /* (GMT+10:00) Hobart */
- {"Tokyo Standard Time", "Tokyo Daylight Time",
- "Asia/Tokyo"}, /* (GMT+09:00) Osaka, Sapporo, Tokyo */
- {"Tonga Standard Time", "Tonga Daylight Time",
- "Pacific/Tongatapu"}, /* (GMT+13:00) Nuku'alofa */
- {"US Eastern Standard Time", "US Eastern Daylight Time",
- "US/Eastern"}, /* (GMT-05:00) Indiana (East) */
- {"US Mountain Standard Time", "US Mountain Daylight Time",
- "US/Arizona"}, /* (GMT-07:00) Arizona */
- {"Vladivostok Standard Time", "Vladivostok Daylight Time",
- "Asia/Vladivostok"}, /* (GMT+10:00) Vladivostok */
- {"W. Australia Standard Time", "W. Australia Daylight Time",
- "Australia/Perth"}, /* (GMT+08:00) Perth */
+ {
+ "Afghanistan Standard Time", "Afghanistan Daylight Time",
+ "Asia/Kabul"
+ }, /* (GMT+04:30) Kabul */
+ {
+ "Alaskan Standard Time", "Alaskan Daylight Time",
+ "US/Alaska"
+ }, /* (GMT-09:00) Alaska */
+ {
+ "Arab Standard Time", "Arab Daylight Time",
+ "Asia/Kuwait"
+ }, /* (GMT+03:00) Kuwait, Riyadh */
+ {
+ "Arabian Standard Time", "Arabian Daylight Time",
+ "Asia/Muscat"
+ }, /* (GMT+04:00) Abu Dhabi, Muscat */
+ {
+ "Arabic Standard Time", "Arabic Daylight Time",
+ "Asia/Baghdad"
+ }, /* (GMT+03:00) Baghdad */
+ {
+ "Atlantic Standard Time", "Atlantic Daylight Time",
+ "Canada/Atlantic"
+ }, /* (GMT-04:00) Atlantic Time (Canada) */
+ {
+ "AUS Central Standard Time", "AUS Central Daylight Time",
+ "Australia/Darwin"
+ }, /* (GMT+09:30) Darwin */
+ {
+ "AUS Eastern Standard Time", "AUS Eastern Daylight Time",
+ "Australia/Canberra"
+ }, /* (GMT+10:00) Canberra, Melbourne, Sydney */
+ {
+ "Azores Standard Time", "Azores Daylight Time",
+ "Atlantic/Azores"
+ }, /* (GMT-01:00) Azores */
+ {
+ "Canada Central Standard Time", "Canada Central Daylight Time",
+ "Canada/Saskatchewan"
+ }, /* (GMT-06:00) Saskatchewan */
+ {
+ "Cape Verde Standard Time", "Cape Verde Daylight Time",
+ "Atlantic/Cape_Verde"
+ }, /* (GMT-01:00) Cape Verde Is. */
+ {
+ "Caucasus Standard Time", "Caucasus Daylight Time",
+ "Asia/Baku"
+ }, /* (GMT+04:00) Baku, Tbilisi, Yerevan */
+ {
+ "Cen. Australia Standard Time", "Cen. Australia Daylight Time",
+ "Australia/Adelaide"
+ }, /* (GMT+09:30) Adelaide */
+ {
+ "Central America Standard Time", "Central America Daylight Time",
+ "CST6CDT"
+ }, /* (GMT-06:00) Central America */
+ {
+ "Central Asia Standard Time", "Central Asia Daylight Time",
+ "Asia/Dhaka"
+ }, /* (GMT+06:00) Astana, Dhaka */
+ {
+ "Central Europe Standard Time", "Central Europe Daylight Time",
+ "Europe/Belgrade"
+ }, /* (GMT+01:00) Belgrade, Bratislava,
+ * Budapest, Ljubljana, Prague */
+ {
+ "Central European Standard Time", "Central European Daylight Time",
+ "Europe/Sarajevo"
+ }, /* (GMT+01:00) Sarajevo, Skopje, Warsaw,
+ * Zagreb */
+ {
+ "Central Pacific Standard Time", "Central Pacific Daylight Time",
+ "Pacific/Noumea"
+ }, /* (GMT+11:00) Magadan, Solomon Is., New
+ * Caledonia */
+ {
+ "Central Standard Time", "Central Daylight Time",
+ "US/Central"
+ }, /* (GMT-06:00) Central Time (US & Canada) */
+ {
+ "China Standard Time", "China Daylight Time",
+ "Asia/Hong_Kong"
+ }, /* (GMT+08:00) Beijing, Chongqing, Hong
+ * Kong, Urumqi */
+ {
+ "Dateline Standard Time", "Dateline Daylight Time",
+ "Etc/GMT+12"
+ }, /* (GMT-12:00) International Date Line
+ * West */
+ {
+ "E. Africa Standard Time", "E. Africa Daylight Time",
+ "Africa/Nairobi"
+ }, /* (GMT+03:00) Nairobi */
+ {
+ "E. Australia Standard Time", "E. Australia Daylight Time",
+ "Australia/Brisbane"
+ }, /* (GMT+10:00) Brisbane */
+ {
+ "E. Europe Standard Time", "E. Europe Daylight Time",
+ "Europe/Bucharest"
+ }, /* (GMT+02:00) Bucharest */
+ {
+ "E. South America Standard Time", "E. South America Daylight Time",
+ "America/Araguaina"
+ }, /* (GMT-03:00) Brasilia */
+ {
+ "Eastern Standard Time", "Eastern Daylight Time",
+ "US/Eastern"
+ }, /* (GMT-05:00) Eastern Time (US & Canada) */
+ {
+ "Egypt Standard Time", "Egypt Daylight Time",
+ "Africa/Cairo"
+ }, /* (GMT+02:00) Cairo */
+ {
+ "Ekaterinburg Standard Time", "Ekaterinburg Daylight Time",
+ "Asia/Yekaterinburg"
+ }, /* (GMT+05:00) Ekaterinburg */
+ {
+ "Fiji Standard Time", "Fiji Daylight Time",
+ "Pacific/Fiji"
+ }, /* (GMT+12:00) Fiji, Kamchatka, Marshall
+ * Is. */
+ {
+ "FLE Standard Time", "FLE Daylight Time",
+ "Europe/Helsinki"
+ }, /* (GMT+02:00) Helsinki, Kyiv, Riga,
+ * Sofia, Tallinn, Vilnius */
+ {
+ "GMT Standard Time", "GMT Daylight Time",
+ "Europe/Dublin"
+ }, /* (GMT) Greenwich Mean Time : Dublin,
+ * Edinburgh, Lisbon, London */
+ {
+ "Greenland Standard Time", "Greenland Daylight Time",
+ "America/Godthab"
+ }, /* (GMT-03:00) Greenland */
+ {
+ "Greenwich Standard Time", "Greenwich Daylight Time",
+ "Africa/Casablanca"
+ }, /* (GMT) Casablanca, Monrovia */
+ {
+ "GTB Standard Time", "GTB Daylight Time",
+ "Europe/Athens"
+ }, /* (GMT+02:00) Athens, Istanbul, Minsk */
+ {
+ "Hawaiian Standard Time", "Hawaiian Daylight Time",
+ "US/Hawaii"
+ }, /* (GMT-10:00) Hawaii */
+ {
+ "India Standard Time", "India Daylight Time",
+ "Asia/Calcutta"
+ }, /* (GMT+05:30) Chennai, Kolkata, Mumbai,
+ * New Delhi */
+ {
+ "Iran Standard Time", "Iran Daylight Time",
+ "Asia/Tehran"
+ }, /* (GMT+03:30) Tehran */
+ {
+ "Jerusalem Standard Time", "Jerusalem Daylight Time",
+ "Asia/Jerusalem"
+ }, /* (GMT+02:00) Jerusalem */
+ {
+ "Korea Standard Time", "Korea Daylight Time",
+ "Asia/Seoul"
+ }, /* (GMT+09:00) Seoul */
+ {
+ "Mexico Standard Time", "Mexico Daylight Time",
+ "America/Mexico_City"
+ }, /* (GMT-06:00) Guadalajara, Mexico City,
+ * Monterrey */
+ {
+ "Mexico Standard Time", "Mexico Daylight Time",
+ "America/La_Paz"
+ }, /* (GMT-07:00) Chihuahua, La Paz, Mazatlan */
+ {
+ "Mid-Atlantic Standard Time", "Mid-Atlantic Daylight Time",
+ "Atlantic/South_Georgia"
+ }, /* (GMT-02:00) Mid-Atlantic */
+ {
+ "Mountain Standard Time", "Mountain Daylight Time",
+ "US/Mountain"
+ }, /* (GMT-07:00) Mountain Time (US & Canada) */
+ {
+ "Myanmar Standard Time", "Myanmar Daylight Time",
+ "Asia/Rangoon"
+ }, /* (GMT+06:30) Rangoon */
+ {
+ "N. Central Asia Standard Time", "N. Central Asia Daylight Time",
+ "Asia/Almaty"
+ }, /* (GMT+06:00) Almaty, Novosibirsk */
+ {
+ "Nepal Standard Time", "Nepal Daylight Time",
+ "Asia/Katmandu"
+ }, /* (GMT+05:45) Kathmandu */
+ {
+ "New Zealand Standard Time", "New Zealand Daylight Time",
+ "Pacific/Auckland"
+ }, /* (GMT+12:00) Auckland, Wellington */
+ {
+ "Newfoundland Standard Time", "Newfoundland Daylight Time",
+ "Canada/Newfoundland"
+ }, /* (GMT-03:30) Newfoundland */
+ {
+ "North Asia East Standard Time", "North Asia East Daylight Time",
+ "Asia/Irkutsk"
+ }, /* (GMT+08:00) Irkutsk, Ulaan Bataar */
+ {
+ "North Asia Standard Time", "North Asia Daylight Time",
+ "Asia/Krasnoyarsk"
+ }, /* (GMT+07:00) Krasnoyarsk */
+ {
+ "Pacific SA Standard Time", "Pacific SA Daylight Time",
+ "America/Santiago"
+ }, /* (GMT-04:00) Santiago */
+ {
+ "Pacific Standard Time", "Pacific Daylight Time",
+ "US/Pacific"
+ }, /* (GMT-08:00) Pacific Time (US & Canada);
+ * Tijuana */
+ {
+ "Romance Standard Time", "Romance Daylight Time",
+ "Europe/Brussels"
+ }, /* (GMT+01:00) Brussels, Copenhagen,
+ * Madrid, Paris */
+ {
+ "Russian Standard Time", "Russian Daylight Time",
+ "Europe/Moscow"
+ }, /* (GMT+03:00) Moscow, St. Petersburg,
+ * Volgograd */
+ {
+ "SA Eastern Standard Time", "SA Eastern Daylight Time",
+ "America/Buenos_Aires"
+ }, /* (GMT-03:00) Buenos Aires, Georgetown */
+ {
+ "SA Pacific Standard Time", "SA Pacific Daylight Time",
+ "America/Bogota"
+ }, /* (GMT-05:00) Bogota, Lima, Quito */
+ {
+ "SA Western Standard Time", "SA Western Daylight Time",
+ "America/Caracas"
+ }, /* (GMT-04:00) Caracas, La Paz */
+ {
+ "Samoa Standard Time", "Samoa Daylight Time",
+ "Pacific/Midway"
+ }, /* (GMT-11:00) Midway Island, Samoa */
+ {
+ "SE Asia Standard Time", "SE Asia Daylight Time",
+ "Asia/Bangkok"
+ }, /* (GMT+07:00) Bangkok, Hanoi, Jakarta */
+ {
+ "Malay Peninsula Standard Time", "Malay Peninsula Daylight Time",
+ "Asia/Kuala_Lumpur"
+ }, /* (GMT+08:00) Kuala Lumpur, Singapore */
+ {
+ "South Africa Standard Time", "South Africa Daylight Time",
+ "Africa/Harare"
+ }, /* (GMT+02:00) Harare, Pretoria */
+ {
+ "Sri Lanka Standard Time", "Sri Lanka Daylight Time",
+ "Asia/Colombo"
+ }, /* (GMT+06:00) Sri Jayawardenepura */
+ {
+ "Taipei Standard Time", "Taipei Daylight Time",
+ "Asia/Taipei"
+ }, /* (GMT+08:00) Taipei */
+ {
+ "Tasmania Standard Time", "Tasmania Daylight Time",
+ "Australia/Hobart"
+ }, /* (GMT+10:00) Hobart */
+ {
+ "Tokyo Standard Time", "Tokyo Daylight Time",
+ "Asia/Tokyo"
+ }, /* (GMT+09:00) Osaka, Sapporo, Tokyo */
+ {
+ "Tonga Standard Time", "Tonga Daylight Time",
+ "Pacific/Tongatapu"
+ }, /* (GMT+13:00) Nuku'alofa */
+ {
+ "US Eastern Standard Time", "US Eastern Daylight Time",
+ "US/Eastern"
+ }, /* (GMT-05:00) Indiana (East) */
+ {
+ "US Mountain Standard Time", "US Mountain Daylight Time",
+ "US/Arizona"
+ }, /* (GMT-07:00) Arizona */
+ {
+ "Vladivostok Standard Time", "Vladivostok Daylight Time",
+ "Asia/Vladivostok"
+ }, /* (GMT+10:00) Vladivostok */
+ {
+ "W. Australia Standard Time", "W. Australia Daylight Time",
+ "Australia/Perth"
+ }, /* (GMT+08:00) Perth */
/* {"W. Central Africa Standard Time", "W. Central Africa Daylight Time",
- ""}, Could not find a match for this one. Excluded for now. */ /* (GMT+01:00) West Central Africa */
- {"W. Europe Standard Time", "W. Europe Daylight Time",
- "CET"}, /* (GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna */
- {"West Asia Standard Time", "West Asia Daylight Time",
- "Asia/Karachi"}, /* (GMT+05:00) Islamabad, Karachi, Tashkent */
- {"West Pacific Standard Time", "West Pacific Daylight Time",
- "Pacific/Guam"}, /* (GMT+10:00) Guam, Port Moresby */
- {"Yakutsk Standard Time", "Yakutsk Daylight Time",
- "Asia/Yakutsk"}, /* (GMT+09:00) Yakutsk */
- {NULL, NULL, NULL}
+ * ""}, Could not find a match for this one. Excluded for now. *//* (G
+ * MT+01:00) West Central Africa */
+ {
+ "W. Europe Standard Time", "W. Europe Daylight Time",
+ "CET"
+ }, /* (GMT+01:00) Amsterdam, Berlin, Bern,
+ * Rome, Stockholm, Vienna */
+ {
+ "West Asia Standard Time", "West Asia Daylight Time",
+ "Asia/Karachi"
+ }, /* (GMT+05:00) Islamabad, Karachi,
+ * Tashkent */
+ {
+ "West Pacific Standard Time", "West Pacific Daylight Time",
+ "Pacific/Guam"
+ }, /* (GMT+10:00) Guam, Port Moresby */
+ {
+ "Yakutsk Standard Time", "Yakutsk Daylight Time",
+ "Asia/Yakutsk"
+ }, /* (GMT+09:00) Yakutsk */
+ {
+ NULL, NULL, NULL
+ }
};
static const char *
identify_system_timezone(void)
{
- int i;
- char tzname[128];
- time_t t = time(NULL);
- struct tm *tm = localtime(&t);
+ int i;
+ char tzname[128];
+ time_t t = time(NULL);
+ struct tm *tm = localtime(&t);
if (!tm)
{
@@ -661,9 +833,9 @@ identify_system_timezone(void)
}
memset(tzname, 0, sizeof(tzname));
- strftime(tzname, sizeof(tzname)-1, "%Z", tm);
+ strftime(tzname, sizeof(tzname) - 1, "%Z", tm);
- for (i=0; win32_tzmap[i].stdname != NULL; i++)
+ for (i = 0; win32_tzmap[i].stdname != NULL; i++)
{
if (strcmp(tzname, win32_tzmap[i].stdname) == 0 ||
strcmp(tzname, win32_tzmap[i].dstname) == 0)
@@ -679,8 +851,7 @@ identify_system_timezone(void)
tzname)));
return NULL;
}
-
-#endif /* WIN32 */
+#endif /* WIN32 */
/*
@@ -724,7 +895,7 @@ tz_acceptable(void)
const char *
select_default_timezone(void)
{
- const char *def_tz;
+ const char *def_tz;
def_tz = getenv("TZ");
if (def_tz && pg_tzset(def_tz) && tz_acceptable())
diff --git a/src/timezone/private.h b/src/timezone/private.h
index 7339ef0db55..922093341b3 100644
--- a/src/timezone/private.h
+++ b/src/timezone/private.h
@@ -6,7 +6,7 @@
* 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/timezone/private.h,v 1.8 2004/05/21 20:59:10 tgl Exp $
+ * $PostgreSQL: pgsql/src/timezone/private.h,v 1.9 2004/08/29 05:07:02 momjian Exp $
*/
/*
@@ -56,6 +56,7 @@
#ifndef remove
extern int unlink(const char *filename);
+
#define remove unlink
#endif /* !defined remove */
diff --git a/src/timezone/strftime.c b/src/timezone/strftime.c
index 791b076e8ed..c23ae7cb6fc 100644
--- a/src/timezone/strftime.c
+++ b/src/timezone/strftime.c
@@ -15,7 +15,7 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/timezone/strftime.c,v 1.4 2004/06/03 02:08:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/timezone/strftime.c,v 1.5 2004/08/29 05:07:02 momjian Exp $
*/
#include "postgres.h"
@@ -65,17 +65,17 @@ static const struct lc_time_T C_time_locale = {
/*
* x_fmt
*
- * C99 requires this format. Using just numbers (as here)
- * makes Quakers happier; it's also compatible with SVR4.
+ * C99 requires this format. Using just numbers (as here) makes Quakers
+ * happier; it's also compatible with SVR4.
*/
"%m/%d/%y",
/*
* c_fmt
*
- * C99 requires this format. Previously this code used "%D %X", but we now
- * conform to C99. Note that "%a %b %d %H:%M:%S %Y" is used by Solaris
- * 2.3.
+ * C99 requires this format. Previously this code used "%D %X", but we
+ * now conform to C99. Note that "%a %b %d %H:%M:%S %Y" is used by
+ * Solaris 2.3.
*/
"%a %b %e %T %Y",
@@ -92,7 +92,7 @@ static const struct lc_time_T C_time_locale = {
static char *_add(const char *, char *, const char *);
static char *_conv(int, const char *, char *, const char *);
static char *_fmt(const char *, const struct pg_tm *, char *,
- const char *, int *);
+ const char *, int *);
#define IN_NONE 0
#define IN_SOME 1
@@ -102,7 +102,7 @@ static char *_fmt(const char *, const struct pg_tm *, char *,
size_t
pg_strftime(char *s, size_t maxsize, const char *format,
- const struct pg_tm *t)
+ const struct pg_tm * t)
{
char *p;
int warn;
@@ -185,10 +185,10 @@ _fmt(const char *format, const struct pg_tm * t, char *pt, const char *ptlim,
case 'O':
/*
- * C99 locale modifiers. The sequences %Ec %EC
- * %Ex %EX %Ey %EY %Od %oe %OH %OI %Om %OM %OS
- * %Ou %OU %OV %Ow %OW %Oy are supposed to provide
- * alternate representations.
+ * C99 locale modifiers. The sequences %Ec %EC %Ex
+ * %EX %Ey %EY %Od %oe %OH %OI %Om %OM %OS %Ou %OU
+ * %OV %Ow %OW %Oy are supposed to provide alternate
+ * representations.
*/
goto label;
case 'e':
@@ -211,11 +211,11 @@ _fmt(const char *format, const struct pg_tm * t, char *pt, const char *ptlim,
case 'k':
/*
- * This used to be... _conv(t->tm_hour % 12 ? t->tm_hour
- * % 12 : 12, 2, ' '); ...and has been changed to the
- * below to match SunOS 4.1.1 and Arnold Robbins' strftime
- * version 3.0. That is, "%k" and "%l" have been
- * swapped. (ado, 1993-05-24)
+ * This used to be... _conv(t->tm_hour % 12 ?
+ * t->tm_hour % 12 : 12, 2, ' '); ...and has been
+ * changed to the below to match SunOS 4.1.1 and
+ * Arnold Robbins' strftime version 3.0. That is,
+ * "%k" and "%l" have been swapped. (ado, 1993-05-24)
*/
pt = _conv(t->tm_hour, "%2d", pt, ptlim);
continue;
@@ -232,10 +232,10 @@ _fmt(const char *format, const struct pg_tm * t, char *pt, const char *ptlim,
/*
* This used to be... _conv(t->tm_hour, 2, ' ');
- * ...and has been changed to the below to match
- * SunOS 4.1.1 and Arnold Robbin's strftime version
- * 3.0. That is, "%k" and "%l" have been swapped.
- * (ado, 1993-05-24)
+ * ...and has been changed to the below to match SunOS
+ * 4.1.1 and Arnold Robbin's strftime version 3.0.
+ * That is, "%k" and "%l" have been swapped. (ado,
+ * 1993-05-24)
*/
pt = _conv((t->tm_hour % 12) ?
(t->tm_hour % 12) : 12,
@@ -279,8 +279,8 @@ _fmt(const char *format, const struct pg_tm * t, char *pt, const char *ptlim,
case 'u':
/*
- * From Arnold Robbins' strftime version 3.0: "ISO 8601:
- * Weekday as a decimal number [1 (Monday) - 7]"
+ * From Arnold Robbins' strftime version 3.0: "ISO
+ * 8601: Weekday as a decimal number [1 (Monday) - 7]"
* (ado, 1993-05-24)
*/
pt = _conv((t->tm_wday == 0) ?
@@ -335,8 +335,7 @@ _fmt(const char *format, const struct pg_tm * t, char *pt, const char *ptlim,
DAYSPERWEEK) - 3;
/*
- * What yday does the NEXT ISO year begin
- * on?
+ * What yday does the NEXT ISO year begin on?
*/
top = bot -
(len % DAYSPERWEEK);
@@ -377,8 +376,8 @@ _fmt(const char *format, const struct pg_tm * t, char *pt, const char *ptlim,
case 'v':
/*
- * From Arnold Robbins' strftime version 3.0:
- * "date as dd-bbb-YYYY" (ado, 1993-05-24)
+ * From Arnold Robbins' strftime version 3.0: "date as
+ * dd-bbb-YYYY" (ado, 1993-05-24)
*/
pt = _fmt("%e-%b-%Y", t, pt, ptlim, warnp);
continue;
diff --git a/src/timezone/zic.c b/src/timezone/zic.c
index ffd9239c28d..3a9308bc624 100644
--- a/src/timezone/zic.c
+++ b/src/timezone/zic.c
@@ -3,7 +3,7 @@
* 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/timezone/zic.c,v 1.11 2004/08/11 16:53:28 tgl Exp $
+ * $PostgreSQL: pgsql/src/timezone/zic.c,v 1.12 2004/08/29 05:07:02 momjian Exp $
*/
#include "postgres.h"
@@ -353,7 +353,7 @@ static const int len_years[2] = {
static struct attype
{
- pg_time_t at;
+ pg_time_t at;
unsigned char type;
} attypes[TZ_MAX_TIMES];
static long gmtoffs[TZ_MAX_TYPES];
@@ -412,8 +412,8 @@ static void
error(const char *string)
{
/*
- * Match the format of "cc" to allow sh users to zic ... 2>&1 |
- * error -t "*" -v on BSD systems.
+ * Match the format of "cc" to allow sh users to zic ... 2>&1 | error
+ * -t "*" -v on BSD systems.
*/
(void) fprintf(stderr, _("\"%s\", line %d: %s"),
filename, linenum, string);
@@ -679,13 +679,13 @@ setboundaries(void)
* pg_time_t is always signed, but might be only 32 bits ...
*/
min_time = ~(pg_time_t) 0;
- min_time <<= TYPE_BIT(pg_time_t) - 1;
+ min_time <<= TYPE_BIT(pg_time_t) -1;
max_time = ~(pg_time_t) 0 - min_time;
/*
- * For the moment, hard-wire the range as 1901 to 2038. We cannot
- * go wider without adopting an incompatible zone file format, which
- * is a step I'd just as soon not take just yet.
+ * For the moment, hard-wire the range as 1901 to 2038. We cannot go
+ * wider without adopting an incompatible zone file format, which is a
+ * step I'd just as soon not take just yet.
*/
min_time = Max(min_time, (pg_time_t) INT_MIN);
max_time = Min(max_time, (pg_time_t) INT_MAX);
@@ -800,8 +800,8 @@ associate(void)
TRUE);
/*
- * Note, though, that if there's no rule, a '%s' in the
- * format is a bad thing.
+ * Note, though, that if there's no rule, a '%s' in the format
+ * is a bad thing.
*/
if (strchr(zp->z_format, '%') != 0)
error(_("%s in ruleless zone"));
@@ -1137,8 +1137,8 @@ inzsub(register char **fields, const int nfields, const int iscont)
zones[nzones++] = z;
/*
- * If there was an UNTIL field on this line, there's more
- * information about the zone on the next line.
+ * If there was an UNTIL field on this line, there's more information
+ * about the zone on the next line.
*/
return hasuntil;
}
@@ -1155,7 +1155,7 @@ inleap(register char **fields, const int nfields)
day;
long dayoff,
tod;
- pg_time_t t;
+ pg_time_t t;
if (nfields != LEAP_FIELDS)
{
@@ -1418,7 +1418,7 @@ rulesub(register struct rule * rp, const char *loyearp, const char *hiyearp,
min_year = rp->r_loyear;
/*
- * Day work. Accept things such as: 1 last-Sunday Sun<=20 Sun>=7
+ * Day work. Accept things such as: 1 last-Sunday Sun<=20 Sun>=7
*/
dp = ecpyalloc(dayp);
if ((lp = byword(dp, lasts)) != NULL)
@@ -1505,7 +1505,7 @@ writezone(const char *name)
j;
static char *fullname;
static struct tzhead tzh;
- pg_time_t ats[TZ_MAX_TIMES];
+ pg_time_t ats[TZ_MAX_TIMES];
unsigned char types[TZ_MAX_TIMES];
/*
@@ -1710,8 +1710,8 @@ outzone(const struct zone * zpfirst, const int zonecount)
charcnt = 0;
/*
- * Thanks to Earl Chew (earl@dnd.icp.nec.com.au) for noting the
- * need to unconditionally initialize startttisstd.
+ * Thanks to Earl Chew (earl@dnd.icp.nec.com.au) for noting the need
+ * to unconditionally initialize startttisstd.
*/
startttisstd = FALSE;
startttisgmt = FALSE;
@@ -1753,8 +1753,8 @@ outzone(const struct zone * zpfirst, const int zonecount)
break;
/*
- * Mark which rules to do in the current year. For
- * those to do, calculate rpytime(rp, year);
+ * Mark which rules to do in the current year. For those
+ * to do, calculate rpytime(rp, year);
*/
for (j = 0; j < zp->z_nrules; ++j)
{
@@ -1778,8 +1778,8 @@ outzone(const struct zone * zpfirst, const int zonecount)
if (useuntil)
{
/*
- * Turn untiltime into UTC assuming the
- * current gmtoff and stdoff values.
+ * Turn untiltime into UTC assuming the current
+ * gmtoff and stdoff values.
*/
untiltime = zp->z_untiltime;
if (!zp->z_untilrule.r_todisgmt)
@@ -1791,8 +1791,8 @@ outzone(const struct zone * zpfirst, const int zonecount)
}
/*
- * Find the rule (of those to do, if any) that
- * takes effect earliest in the year.
+ * Find the rule (of those to do, if any) that takes
+ * effect earliest in the year.
*/
k = -1;
for (j = 0; j < zp->z_nrules; ++j)
@@ -1955,8 +1955,7 @@ addtype(const long gmtoff, const char *abbr, const int isdst,
}
/*
- * There isn't one; add a new one, unless there are already too
- * many.
+ * There isn't one; add a new one, unless there are already too many.
*/
if (typecnt >= TZ_MAX_TYPES)
{
@@ -2333,10 +2332,9 @@ mkdirs(char *argname)
if (!itsdir(name))
{
/*
- * It doesn't seem to exist, so we try to create it.
- * Creation may fail because of the directory being created
- * by some other multiprocessor, so we get to do extra
- * checking.
+ * It doesn't seem to exist, so we try to create it. Creation
+ * may fail because of the directory being created by some
+ * other multiprocessor, so we get to do extra checking.
*/
if (mkdir(name, MKDIR_UMASK) != 0)
{