1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-20 05:03:10 +03:00

Revert recent change of to_char('HH12') handling for intervals; instead

improve documentation, and add C comment.
This commit is contained in:
Bruce Momjian
2010-02-23 16:14:26 +00:00
parent 4f56dc3fb4
commit a54803149a
2 changed files with 8 additions and 7 deletions

View File

@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------
* formatting.c
*
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.165 2010/02/23 06:29:01 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.166 2010/02/23 16:14:26 momjian Exp $
*
*
* Portions Copyright (c) 1999-2010, PostgreSQL Global Development Group
@ -2088,10 +2088,10 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out)
break;
case DCH_HH:
case DCH_HH12:
/* display time as shown on a 12-hour clock, even for intervals */
sprintf(s, "%0*d", S_FM(n->suffix) ? 0 : 2,
is_interval ? tm->tm_hour :
tm->tm_hour % (HOURS_PER_DAY / 2) == 0 ?
12 : tm->tm_hour % (HOURS_PER_DAY / 2));
tm->tm_hour % (HOURS_PER_DAY / 2) == 0 ? 12 :
tm->tm_hour % (HOURS_PER_DAY / 2));
if (S_THth(n->suffix))
str_numth(s, s, S_TH_TYPE(n->suffix));
s += strlen(s);