Commit 9c800b8e authored by Thomas G. Lockhart's avatar Thomas G. Lockhart

Fix delta time decoding for 12 AM/PM.

parent addf9d5f
......@@ -7,7 +7,7 @@
*
*
* 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))
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;
#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))
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;
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
* values
* read through remaining list backwards to pick up units before values
*/
for (i = nf - 1; i >= ii; i--)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment