88 *
99 *
1010 * IDENTIFICATION
11- * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.204 2009/05/01 19:29:07 tgl Exp $
11+ * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.205 2009/05/26 02:17:50 tgl Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -3601,11 +3601,10 @@ EncodeTimezone(char *str, int tz, int style)
36013601/* EncodeDateOnly()
36023602 * Encode date as local time.
36033603 */
3604- int
3604+ void
36053605EncodeDateOnly (struct pg_tm * tm , int style , char * str )
36063606{
3607- if (tm -> tm_mon < 1 || tm -> tm_mon > MONTHS_PER_YEAR )
3608- return -1 ;
3607+ Assert (tm -> tm_mon >= 1 && tm -> tm_mon <= MONTHS_PER_YEAR );
36093608
36103609 switch (style )
36113610 {
@@ -3654,30 +3653,23 @@ EncodeDateOnly(struct pg_tm * tm, int style, char *str)
36543653 sprintf (str + 5 , "-%04d %s" , - (tm -> tm_year - 1 ), "BC" );
36553654 break ;
36563655 }
3657-
3658- return TRUE;
3659- } /* EncodeDateOnly() */
3656+ }
36603657
36613658
36623659/* EncodeTimeOnly()
36633660 * Encode time fields only.
36643661 */
3665- int
3662+ void
36663663EncodeTimeOnly (struct pg_tm * tm , fsec_t fsec , int * tzp , int style , char * str )
36673664{
3668- if (tm -> tm_hour < 0 || tm -> tm_hour > HOURS_PER_DAY )
3669- return -1 ;
3670-
36713665 sprintf (str , "%02d:%02d:" , tm -> tm_hour , tm -> tm_min );
36723666 str += strlen (str );
36733667
36743668 AppendSeconds (str , tm -> tm_sec , fsec , MAX_TIME_PRECISION , true);
36753669
36763670 if (tzp != NULL )
36773671 EncodeTimezone (str , * tzp , style );
3678-
3679- return TRUE;
3680- } /* EncodeTimeOnly() */
3672+ }
36813673
36823674
36833675/* EncodeDateTime()
@@ -3692,15 +3684,11 @@ EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, int *tzp, int style, char *str)
36923684 * US - mm/dd/yyyy
36933685 * European - dd/mm/yyyy
36943686 */
3695- int
3687+ void
36963688EncodeDateTime (struct pg_tm * tm , fsec_t fsec , int * tzp , char * * tzn , int style , char * str )
36973689{
36983690 int day ;
36993691
3700- /*
3701- * Why are we checking only the month field? Change this to an assert...
3702- * if (tm->tm_mon < 1 || tm->tm_mon > MONTHS_PER_YEAR) return -1;
3703- */
37043692 Assert (tm -> tm_mon >= 1 && tm -> tm_mon <= MONTHS_PER_YEAR );
37053693
37063694 switch (style )
@@ -3825,8 +3813,6 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style,
38253813 sprintf (str + strlen (str ), " BC" );
38263814 break ;
38273815 }
3828-
3829- return TRUE;
38303816}
38313817
38323818
@@ -3906,7 +3892,7 @@ AddVerboseIntPart(char *cp, int value, const char *units,
39063892 * "year-month literal"s (that look like '2-3') and
39073893 * "day-time literal"s (that look like ('4 5:6:7')
39083894 */
3909- int
3895+ void
39103896EncodeInterval (struct pg_tm * tm , fsec_t fsec , int style , char * str )
39113897{
39123898 char * cp = str ;
@@ -4083,9 +4069,7 @@ EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str)
40834069 strcat (cp , " ago" );
40844070 break ;
40854071 }
4086-
4087- return 0 ;
4088- } /* EncodeInterval() */
4072+ }
40894073
40904074
40914075/*
0 commit comments