diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2014-03-04 15:09:43 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2014-03-04 15:09:43 -0300 |
commit | 84df54b22e8035addc7108abd9ff6995e8c49264 (patch) | |
tree | bf98f8391df7cae81b338e39d506fd98a3b37f01 /src/backend/utils/adt/datetime.c | |
parent | af2543e884db06c0beb75010218cd88680203b86 (diff) | |
download | postgresql-84df54b22e8035addc7108abd9ff6995e8c49264.tar.gz postgresql-84df54b22e8035addc7108abd9ff6995e8c49264.zip |
Constructors for interval, timestamp, timestamptz
Author: Pavel Stěhule, editorialized somewhat by Álvaro Herrera
Reviewed-by: Tomáš Vondra, Marko Tiikkaja
With input from Fabrízio de Royes Mello, Jim Nasby
Diffstat (limited to 'src/backend/utils/adt/datetime.c')
-rw-r--r-- | src/backend/utils/adt/datetime.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index 0d32428e407..d200437e628 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -40,7 +40,6 @@ static int DecodeNumberField(int len, char *str, struct pg_tm * tm, fsec_t *fsec, bool *is2digits); static int DecodeTime(char *str, int fmask, int range, int *tmask, struct pg_tm * tm, fsec_t *fsec); -static int DecodeTimezone(char *str, int *tzp); static const datetkn *datebsearch(const char *key, const datetkn *base, int nel); static int DecodeDate(char *str, int fmask, int *tmask, bool *is2digits, struct pg_tm * tm); @@ -2075,6 +2074,9 @@ DecodeTimeOnly(char **field, int *ftype, int nf, else if (mer == PM && tm->tm_hour != HOURS_PER_DAY / 2) tm->tm_hour += HOURS_PER_DAY / 2; + /* + * This should match the checks in make_timestamp_internal + */ if (tm->tm_hour < 0 || tm->tm_min < 0 || tm->tm_min > MINS_PER_HOUR - 1 || tm->tm_sec < 0 || tm->tm_sec > SECS_PER_MINUTE || tm->tm_hour > HOURS_PER_DAY || @@ -2707,7 +2709,7 @@ DecodeNumberField(int len, char *str, int fmask, * * NB: this must *not* ereport on failure; see commands/variable.c. */ -static int +int DecodeTimezone(char *str, int *tzp) { int tz; |