[HACKERS] [PATCH] Change missleading comment for tm_mon field of pg_tm structure

Поиск
Список
Период
Сортировка
От Dmitry Fedin
Тема [HACKERS] [PATCH] Change missleading comment for tm_mon field of pg_tm structure
Дата
Msg-id CAPZVg5jk8y6+5Ehm=POwChzVr9Jm=4btW7LshgLDhsDogJ0WaQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: [HACKERS] [PATCH] Change missleading comment for tm_mon field ofpg_tm structure  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
According to usages, tm_mon (month) field has origin 1, not 0. This is
difference from C-library version of struct tm, which has origin 0 for
real.
For example:

```C
if (DateOrder == DATEORDER_DMY)   sprintf(str, "%02d/%02d", tm->tm_mday, tm->tm_mon);
else   sprintf(str, "%02d/%02d", tm->tm_mon, tm->tm_mday);
in src/backend/utils/adt/datetime.c

```
---src/include/pgtime.h | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/include/pgtime.h b/src/include/pgtime.h
index dcd0730..52b54b9 100644
--- a/src/include/pgtime.h
+++ b/src/include/pgtime.h
@@ -28,7 +28,7 @@ struct pg_tm int tm_min; int tm_hour; int tm_mday;
- int tm_mon; /* origin 0, not 1 */
+ int tm_mon; /* origin 1, not 0! */ int tm_year; /* relative to 1900 */ int tm_wday; int tm_yday;



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] Parallel Index Scans
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: [HACKERS] SEGFAULT in HEAD with replication