8
8
*
9
9
*
10
10
* 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 $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -3601,11 +3601,10 @@ EncodeTimezone(char *str, int tz, int style)
3601
3601
/* EncodeDateOnly()
3602
3602
* Encode date as local time.
3603
3603
*/
3604
- int
3604
+ void
3605
3605
EncodeDateOnly (struct pg_tm * tm , int style , char * str )
3606
3606
{
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 );
3609
3608
3610
3609
switch (style )
3611
3610
{
@@ -3654,30 +3653,23 @@ EncodeDateOnly(struct pg_tm * tm, int style, char *str)
3654
3653
sprintf (str + 5 , "-%04d %s" , - (tm -> tm_year - 1 ), "BC" );
3655
3654
break ;
3656
3655
}
3657
-
3658
- return TRUE;
3659
- } /* EncodeDateOnly() */
3656
+ }
3660
3657
3661
3658
3662
3659
/* EncodeTimeOnly()
3663
3660
* Encode time fields only.
3664
3661
*/
3665
- int
3662
+ void
3666
3663
EncodeTimeOnly (struct pg_tm * tm , fsec_t fsec , int * tzp , int style , char * str )
3667
3664
{
3668
- if (tm -> tm_hour < 0 || tm -> tm_hour > HOURS_PER_DAY )
3669
- return -1 ;
3670
-
3671
3665
sprintf (str , "%02d:%02d:" , tm -> tm_hour , tm -> tm_min );
3672
3666
str += strlen (str );
3673
3667
3674
3668
AppendSeconds (str , tm -> tm_sec , fsec , MAX_TIME_PRECISION , true);
3675
3669
3676
3670
if (tzp != NULL )
3677
3671
EncodeTimezone (str , * tzp , style );
3678
-
3679
- return TRUE;
3680
- } /* EncodeTimeOnly() */
3672
+ }
3681
3673
3682
3674
3683
3675
/* EncodeDateTime()
@@ -3692,15 +3684,11 @@ EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, int *tzp, int style, char *str)
3692
3684
* US - mm/dd/yyyy
3693
3685
* European - dd/mm/yyyy
3694
3686
*/
3695
- int
3687
+ void
3696
3688
EncodeDateTime (struct pg_tm * tm , fsec_t fsec , int * tzp , char * * tzn , int style , char * str )
3697
3689
{
3698
3690
int day ;
3699
3691
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
- */
3704
3692
Assert (tm -> tm_mon >= 1 && tm -> tm_mon <= MONTHS_PER_YEAR );
3705
3693
3706
3694
switch (style )
@@ -3825,8 +3813,6 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style,
3825
3813
sprintf (str + strlen (str ), " BC" );
3826
3814
break ;
3827
3815
}
3828
-
3829
- return TRUE;
3830
3816
}
3831
3817
3832
3818
@@ -3906,7 +3892,7 @@ AddVerboseIntPart(char *cp, int value, const char *units,
3906
3892
* "year-month literal"s (that look like '2-3') and
3907
3893
* "day-time literal"s (that look like ('4 5:6:7')
3908
3894
*/
3909
- int
3895
+ void
3910
3896
EncodeInterval (struct pg_tm * tm , fsec_t fsec , int style , char * str )
3911
3897
{
3912
3898
char * cp = str ;
@@ -4083,9 +4069,7 @@ EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str)
4083
4069
strcat (cp , " ago" );
4084
4070
break ;
4085
4071
}
4086
-
4087
- return 0 ;
4088
- } /* EncodeInterval() */
4072
+ }
4089
4073
4090
4074
4091
4075
/*
0 commit comments