mirror of
https://github.com/postgres/postgres.git
synced 2025-07-12 21:01:52 +03:00
Fix delta time decoding for 12 AM/PM.
This commit is contained in:
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.41 1997/09/20 16:20:29 thomas Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.42 1997/10/17 05:36:01 thomas Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -3036,7 +3036,9 @@ DecodeDateTime(char *field[], int ftype[], int nf,
|
|||||||
|
|
||||||
if ((mer != HR24) && (tm->tm_hour > 12))
|
if ((mer != HR24) && (tm->tm_hour > 12))
|
||||||
return -1;
|
return -1;
|
||||||
if (mer == PM)
|
if ((mer == AM) && (tm->tm_hour == 12))
|
||||||
|
tm->tm_hour = 0;
|
||||||
|
else if ((mer == PM) && (tm->tm_hour != 12))
|
||||||
tm->tm_hour += 12;
|
tm->tm_hour += 12;
|
||||||
|
|
||||||
#ifdef DATEDEBUG
|
#ifdef DATEDEBUG
|
||||||
@ -3205,7 +3207,9 @@ DecodeTimeOnly(char *field[], int ftype[], int nf, int *dtype, struct tm * tm, d
|
|||||||
|
|
||||||
if ((mer != HR24) && (tm->tm_hour > 12))
|
if ((mer != HR24) && (tm->tm_hour > 12))
|
||||||
return -1;
|
return -1;
|
||||||
if (mer == PM)
|
if ((mer == AM) && (tm->tm_hour == 12))
|
||||||
|
tm->tm_hour = 0;
|
||||||
|
else if ((mer == PM) && (tm->tm_hour != 12))
|
||||||
tm->tm_hour += 12;
|
tm->tm_hour += 12;
|
||||||
|
|
||||||
if ((fmask & DTK_TIME_M) != DTK_TIME_M)
|
if ((fmask & DTK_TIME_M) != DTK_TIME_M)
|
||||||
@ -3746,8 +3750,7 @@ DecodeDateDelta(char *field[], int ftype[], int nf, int *dtype, struct tm * tm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* read through remaining list backwards to pick up units before
|
* read through remaining list backwards to pick up units before values
|
||||||
* values
|
|
||||||
*/
|
*/
|
||||||
for (i = nf - 1; i >= ii; i--)
|
for (i = nf - 1; i >= ii; i--)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user