mirror of
https://github.com/postgres/postgres.git
synced 2025-07-20 05:03:10 +03:00
Code spacing improvement, particularly *tm spacing.
This commit is contained in:
src
backend
include
interfaces
ecpg
pgtypeslib
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.116 2005/07/21 18:06:12 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.117 2005/07/22 03:46:33 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -38,10 +38,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int time2tm(TimeADT time, struct pg_tm * tm, fsec_t *fsec);
|
static int time2tm(TimeADT time, struct pg_tm *tm, fsec_t *fsec);
|
||||||
static int timetz2tm(TimeTzADT *time, struct pg_tm * tm, fsec_t *fsec, int *tzp);
|
static int timetz2tm(TimeTzADT *time, struct pg_tm *tm, fsec_t *fsec, int *tzp);
|
||||||
static int tm2time(struct pg_tm * tm, fsec_t fsec, TimeADT *result);
|
static int tm2time(struct pg_tm *tm, fsec_t fsec, TimeADT *result);
|
||||||
static int tm2timetz(struct pg_tm * tm, fsec_t fsec, int tz, TimeTzADT *result);
|
static int tm2timetz(struct pg_tm *tm, fsec_t fsec, int tz, TimeTzADT *result);
|
||||||
static void AdjustTimeForTypmod(TimeADT *time, int32 typmod);
|
static void AdjustTimeForTypmod(TimeADT *time, int32 typmod);
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -914,7 +914,7 @@ time_in(PG_FUNCTION_ARGS)
|
|||||||
* Convert a tm structure to a time data type.
|
* Convert a tm structure to a time data type.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
tm2time(struct pg_tm * tm, fsec_t fsec, TimeADT *result)
|
tm2time(struct pg_tm *tm, fsec_t fsec, TimeADT *result)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
*result = ((((tm->tm_hour * MINS_PER_HOUR + tm->tm_min) * SECS_PER_MINUTE) + tm->tm_sec)
|
*result = ((((tm->tm_hour * MINS_PER_HOUR + tm->tm_min) * SECS_PER_MINUTE) + tm->tm_sec)
|
||||||
@ -931,7 +931,7 @@ tm2time(struct pg_tm * tm, fsec_t fsec, TimeADT *result)
|
|||||||
* local time zone. If out of this range, leave as GMT. - tgl 97/05/27
|
* local time zone. If out of this range, leave as GMT. - tgl 97/05/27
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
time2tm(TimeADT time, struct pg_tm * tm, fsec_t *fsec)
|
time2tm(TimeADT time, struct pg_tm *tm, fsec_t *fsec)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
tm->tm_hour = time / USECS_PER_HOUR;
|
tm->tm_hour = time / USECS_PER_HOUR;
|
||||||
@ -1711,7 +1711,7 @@ time_part(PG_FUNCTION_ARGS)
|
|||||||
* Convert a tm structure to a time data type.
|
* Convert a tm structure to a time data type.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
tm2timetz(struct pg_tm * tm, fsec_t fsec, int tz, TimeTzADT *result)
|
tm2timetz(struct pg_tm *tm, fsec_t fsec, int tz, TimeTzADT *result)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
result->time = ((((tm->tm_hour * MINS_PER_HOUR + tm->tm_min) * SECS_PER_MINUTE) + tm->tm_sec) *
|
result->time = ((((tm->tm_hour * MINS_PER_HOUR + tm->tm_min) * SECS_PER_MINUTE) + tm->tm_sec) *
|
||||||
@ -1828,7 +1828,7 @@ timetz_send(PG_FUNCTION_ARGS)
|
|||||||
* Convert TIME WITH TIME ZONE data type to POSIX time structure.
|
* Convert TIME WITH TIME ZONE data type to POSIX time structure.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
timetz2tm(TimeTzADT *time, struct pg_tm * tm, fsec_t *fsec, int *tzp)
|
timetz2tm(TimeTzADT *time, struct pg_tm *tm, fsec_t *fsec, int *tzp)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
int64 trem = time->time;
|
int64 trem = time->time;
|
||||||
@ -2291,7 +2291,7 @@ datetimetz_timestamptz(PG_FUNCTION_ARGS)
|
|||||||
TimestampTz result;
|
TimestampTz result;
|
||||||
|
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
result = (date * USECS_PER_DAY + time->time) + time->zone * USECS_PER_SEC;
|
result = date * USECS_PER_DAY + time->time + time->zone * USECS_PER_SEC;
|
||||||
#else
|
#else
|
||||||
result = date * (double)SECS_PER_DAY + time->time + time->zone;
|
result = date * (double)SECS_PER_DAY + time->time + time->zone;
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.155 2005/07/21 18:06:12 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.156 2005/07/22 03:46:33 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -28,16 +28,16 @@
|
|||||||
|
|
||||||
static int DecodeNumber(int flen, char *field, bool haveTextMonth,
|
static int DecodeNumber(int flen, char *field, bool haveTextMonth,
|
||||||
int fmask, int *tmask,
|
int fmask, int *tmask,
|
||||||
struct pg_tm * tm, fsec_t *fsec, int *is2digits);
|
struct pg_tm *tm, fsec_t *fsec, int *is2digits);
|
||||||
static int DecodeNumberField(int len, char *str,
|
static int DecodeNumberField(int len, char *str,
|
||||||
int fmask, int *tmask,
|
int fmask, int *tmask,
|
||||||
struct pg_tm * tm, fsec_t *fsec, int *is2digits);
|
struct pg_tm *tm, fsec_t *fsec, int *is2digits);
|
||||||
static int DecodeTime(char *str, int fmask, int *tmask,
|
static int DecodeTime(char *str, int fmask, int *tmask,
|
||||||
struct pg_tm * tm, fsec_t *fsec);
|
struct pg_tm *tm, fsec_t *fsec);
|
||||||
static int DecodeTimezone(char *str, int *tzp);
|
static int DecodeTimezone(char *str, int *tzp);
|
||||||
static int DecodePosixTimezone(char *str, int *tzp);
|
static int DecodePosixTimezone(char *str, int *tzp);
|
||||||
static datetkn *datebsearch(char *key, datetkn *base, unsigned int nel);
|
static datetkn *datebsearch(char *key, datetkn *base, unsigned int nel);
|
||||||
static int DecodeDate(char *str, int fmask, int *tmask, struct pg_tm * tm);
|
static int DecodeDate(char *str, int fmask, int *tmask, struct pg_tm *tm);
|
||||||
static void TrimTrailingZeros(char *str);
|
static void TrimTrailingZeros(char *str);
|
||||||
|
|
||||||
|
|
||||||
@ -681,7 +681,7 @@ j2day(int date)
|
|||||||
* Get the transaction start time ("now()") broken down as a struct pg_tm.
|
* Get the transaction start time ("now()") broken down as a struct pg_tm.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
GetCurrentDateTime(struct pg_tm * tm)
|
GetCurrentDateTime(struct pg_tm *tm)
|
||||||
{
|
{
|
||||||
int tz;
|
int tz;
|
||||||
fsec_t fsec;
|
fsec_t fsec;
|
||||||
@ -698,7 +698,7 @@ GetCurrentDateTime(struct pg_tm * tm)
|
|||||||
* including fractional seconds and timezone offset.
|
* including fractional seconds and timezone offset.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
GetCurrentTimeUsec(struct pg_tm * tm, fsec_t *fsec, int *tzp)
|
GetCurrentTimeUsec(struct pg_tm *tm, fsec_t *fsec, int *tzp)
|
||||||
{
|
{
|
||||||
int tz;
|
int tz;
|
||||||
|
|
||||||
@ -969,7 +969,7 @@ ParseDateTime(const char *timestr, char *workbuf, size_t buflen,
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
DecodeDateTime(char **field, int *ftype, int nf,
|
DecodeDateTime(char **field, int *ftype, int nf,
|
||||||
int *dtype, struct pg_tm * tm, fsec_t *fsec, int *tzp)
|
int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp)
|
||||||
{
|
{
|
||||||
int fmask = 0,
|
int fmask = 0,
|
||||||
tmask,
|
tmask,
|
||||||
@ -1632,7 +1632,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
|
|||||||
* of mktime(), anyway.
|
* of mktime(), anyway.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
DetermineLocalTimeZone(struct pg_tm * tm)
|
DetermineLocalTimeZone(struct pg_tm *tm)
|
||||||
{
|
{
|
||||||
int date,
|
int date,
|
||||||
sec;
|
sec;
|
||||||
@ -1760,7 +1760,7 @@ overflow:
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
DecodeTimeOnly(char **field, int *ftype, int nf,
|
DecodeTimeOnly(char **field, int *ftype, int nf,
|
||||||
int *dtype, struct pg_tm * tm, fsec_t *fsec, int *tzp)
|
int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp)
|
||||||
{
|
{
|
||||||
int fmask = 0,
|
int fmask = 0,
|
||||||
tmask,
|
tmask,
|
||||||
@ -2296,7 +2296,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
|
|||||||
* Insist on a complete set of fields.
|
* Insist on a complete set of fields.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
DecodeDate(char *str, int fmask, int *tmask, struct pg_tm * tm)
|
DecodeDate(char *str, int fmask, int *tmask, struct pg_tm *tm)
|
||||||
{
|
{
|
||||||
fsec_t fsec;
|
fsec_t fsec;
|
||||||
int nf = 0;
|
int nf = 0;
|
||||||
@ -2454,7 +2454,7 @@ DecodeDate(char *str, int fmask, int *tmask, struct pg_tm * tm)
|
|||||||
* can be used to represent time spans.
|
* can be used to represent time spans.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
DecodeTime(char *str, int fmask, int *tmask, struct pg_tm * tm, fsec_t *fsec)
|
DecodeTime(char *str, int fmask, int *tmask, struct pg_tm *tm, fsec_t *fsec)
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
@ -2518,7 +2518,7 @@ DecodeTime(char *str, int fmask, int *tmask, struct pg_tm * tm, fsec_t *fsec)
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask,
|
DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask,
|
||||||
int *tmask, struct pg_tm * tm, fsec_t *fsec, int *is2digits)
|
int *tmask, struct pg_tm *tm, fsec_t *fsec, int *is2digits)
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
char *cp;
|
char *cp;
|
||||||
@ -2708,7 +2708,7 @@ DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask,
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
DecodeNumberField(int len, char *str, int fmask,
|
DecodeNumberField(int len, char *str, int fmask,
|
||||||
int *tmask, struct pg_tm * tm, fsec_t *fsec, int *is2digits)
|
int *tmask, struct pg_tm *tm, fsec_t *fsec, int *is2digits)
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
@ -2966,7 +2966,7 @@ DecodeSpecial(int field, char *lowtoken, int *val)
|
|||||||
* preceding an hh:mm:ss field. - thomas 1998-04-30
|
* preceding an hh:mm:ss field. - thomas 1998-04-30
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct pg_tm * tm, fsec_t *fsec)
|
DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct pg_tm *tm, fsec_t *fsec)
|
||||||
{
|
{
|
||||||
int is_before = FALSE;
|
int is_before = FALSE;
|
||||||
char *cp;
|
char *cp;
|
||||||
@ -3420,7 +3420,7 @@ datebsearch(char *key, datetkn *base, unsigned int nel)
|
|||||||
* Encode date as local time.
|
* Encode date as local time.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
EncodeDateOnly(struct pg_tm * tm, int style, char *str)
|
EncodeDateOnly(struct pg_tm *tm, int style, char *str)
|
||||||
{
|
{
|
||||||
if (tm->tm_mon < 1 || tm->tm_mon > MONTHS_PER_YEAR)
|
if (tm->tm_mon < 1 || tm->tm_mon > MONTHS_PER_YEAR)
|
||||||
return -1;
|
return -1;
|
||||||
@ -3480,7 +3480,7 @@ EncodeDateOnly(struct pg_tm * tm, int style, char *str)
|
|||||||
* Encode time fields only.
|
* Encode time fields only.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, int *tzp, int style, char *str)
|
EncodeTimeOnly(struct pg_tm *tm, fsec_t fsec, int *tzp, int style, char *str)
|
||||||
{
|
{
|
||||||
if (tm->tm_hour < 0 || tm->tm_hour > HOURS_PER_DAY)
|
if (tm->tm_hour < 0 || tm->tm_hour > HOURS_PER_DAY)
|
||||||
return -1;
|
return -1;
|
||||||
@ -3530,7 +3530,7 @@ EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, int *tzp, int style, char *str)
|
|||||||
* European - dd/mm/yyyy
|
* European - dd/mm/yyyy
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, char *str)
|
EncodeDateTime(struct pg_tm *tm, fsec_t fsec, int *tzp, char **tzn, int style, char *str)
|
||||||
{
|
{
|
||||||
int day,
|
int day,
|
||||||
hour,
|
hour,
|
||||||
@ -3770,7 +3770,7 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style,
|
|||||||
* - thomas 1998-04-30
|
* - thomas 1998-04-30
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str)
|
EncodeInterval(struct pg_tm *tm, fsec_t fsec, int style, char *str)
|
||||||
{
|
{
|
||||||
int is_before = FALSE;
|
int is_before = FALSE;
|
||||||
int is_nonzero = FALSE;
|
int is_nonzero = FALSE;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.139 2005/07/21 18:06:12 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.140 2005/07/22 03:46:33 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -77,8 +77,8 @@
|
|||||||
* Function prototypes -- internal to this file only
|
* Function prototypes -- internal to this file only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static AbsoluteTime tm2abstime(struct pg_tm * tm, int tz);
|
static AbsoluteTime tm2abstime(struct pg_tm *tm, int tz);
|
||||||
static void reltime2tm(RelativeTime time, struct pg_tm * tm);
|
static void reltime2tm(RelativeTime time, struct pg_tm *tm);
|
||||||
static int istinterval(char *i_string,
|
static int istinterval(char *i_string,
|
||||||
AbsoluteTime *i_start,
|
AbsoluteTime *i_start,
|
||||||
AbsoluteTime *i_end);
|
AbsoluteTime *i_end);
|
||||||
@ -100,7 +100,7 @@ GetCurrentAbsoluteTime(void)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
abstime2tm(AbsoluteTime _time, int *tzp, struct pg_tm * tm, char **tzn)
|
abstime2tm(AbsoluteTime _time, int *tzp, struct pg_tm *tm, char **tzn)
|
||||||
{
|
{
|
||||||
pg_time_t time = (pg_time_t) _time;
|
pg_time_t time = (pg_time_t) _time;
|
||||||
struct pg_tm *tx;
|
struct pg_tm *tx;
|
||||||
@ -178,7 +178,7 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct pg_tm * tm, char **tzn)
|
|||||||
* Note that tm has full year (not 1900-based) and 1-based month.
|
* Note that tm has full year (not 1900-based) and 1-based month.
|
||||||
*/
|
*/
|
||||||
static AbsoluteTime
|
static AbsoluteTime
|
||||||
tm2abstime(struct pg_tm * tm, int tz)
|
tm2abstime(struct pg_tm *tm, int tz)
|
||||||
{
|
{
|
||||||
int day;
|
int day;
|
||||||
AbsoluteTime sec;
|
AbsoluteTime sec;
|
||||||
@ -698,7 +698,7 @@ reltimesend(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
reltime2tm(RelativeTime time, struct pg_tm * tm)
|
reltime2tm(RelativeTime time, struct pg_tm *tm)
|
||||||
{
|
{
|
||||||
double dtime = time;
|
double dtime = time;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.138 2005/07/21 18:06:12 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.139 2005/07/22 03:46:34 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1059,7 +1059,7 @@ timestamp2tm(Timestamp dt, int *tzp, struct pg_tm *tm, fsec_t *fsec, char **tzn,
|
|||||||
* We have a brute force time zone per SQL99? Then use it without
|
* We have a brute force time zone per SQL99? Then use it without
|
||||||
* change since we have already rotated to the time zone.
|
* change since we have already rotated to the time zone.
|
||||||
*/
|
*/
|
||||||
if ((attimezone==NULL) && HasCTZSet)
|
if ((attimezone == NULL) && HasCTZSet)
|
||||||
{
|
{
|
||||||
*tzp = CTimeZone;
|
*tzp = CTimeZone;
|
||||||
tm->tm_isdst = 0;
|
tm->tm_isdst = 0;
|
||||||
@ -1090,7 +1090,8 @@ timestamp2tm(Timestamp dt, int *tzp, struct pg_tm *tm, fsec_t *fsec, char **tzn,
|
|||||||
utime = (pg_time_t) dt;
|
utime = (pg_time_t) dt;
|
||||||
if ((Timestamp) utime == dt)
|
if ((Timestamp) utime == dt)
|
||||||
{
|
{
|
||||||
struct pg_tm *tx = pg_localtime(&utime, (attimezone!=NULL)?attimezone:global_timezone);
|
struct pg_tm *tx = pg_localtime(&utime, (attimezone != NULL) ?
|
||||||
|
attimezone : global_timezone);
|
||||||
|
|
||||||
tm->tm_year = tx->tm_year + 1900;
|
tm->tm_year = tx->tm_year + 1900;
|
||||||
tm->tm_mon = tx->tm_mon + 1;
|
tm->tm_mon = tx->tm_mon + 1;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/include/pgtime.h,v 1.8 2005/06/15 00:34:09 momjian Exp $
|
* $PostgreSQL: pgsql/src/include/pgtime.h,v 1.9 2005/07/22 03:46:34 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -49,7 +49,7 @@ extern int pg_next_dst_boundary(const pg_time_t *timep,
|
|||||||
int *after_isdst,
|
int *after_isdst,
|
||||||
const pg_tz *tz);
|
const pg_tz *tz);
|
||||||
extern size_t pg_strftime(char *s, size_t max, const char *format,
|
extern size_t pg_strftime(char *s, size_t max, const char *format,
|
||||||
const struct pg_tm * tm);
|
const struct pg_tm *tm);
|
||||||
|
|
||||||
extern void pg_timezone_initialize(void);
|
extern void pg_timezone_initialize(void);
|
||||||
extern pg_tz *pg_tzset(const char *tzname);
|
extern pg_tz *pg_tzset(const char *tzname);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/include/utils/datetime.h,v 1.54 2005/05/26 02:04:14 neilc Exp $
|
* $PostgreSQL: pgsql/src/include/utils/datetime.h,v 1.55 2005/07/22 03:46:34 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -271,8 +271,8 @@ extern const int day_tab[2][13];
|
|||||||
#define DTERR_TZDISP_OVERFLOW (-5)
|
#define DTERR_TZDISP_OVERFLOW (-5)
|
||||||
|
|
||||||
|
|
||||||
extern void GetCurrentDateTime(struct pg_tm * tm);
|
extern void GetCurrentDateTime(struct pg_tm *tm);
|
||||||
extern void GetCurrentTimeUsec(struct pg_tm * tm, fsec_t *fsec, int *tzp);
|
extern void GetCurrentTimeUsec(struct pg_tm *tm, fsec_t *fsec, int *tzp);
|
||||||
extern void j2date(int jd, int *year, int *month, int *day);
|
extern void j2date(int jd, int *year, int *month, int *day);
|
||||||
extern int date2j(int year, int month, int day);
|
extern int date2j(int year, int month, int day);
|
||||||
|
|
||||||
@ -281,22 +281,22 @@ extern int ParseDateTime(const char *timestr, char *workbuf, size_t buflen,
|
|||||||
int maxfields, int *numfields);
|
int maxfields, int *numfields);
|
||||||
extern int DecodeDateTime(char **field, int *ftype,
|
extern int DecodeDateTime(char **field, int *ftype,
|
||||||
int nf, int *dtype,
|
int nf, int *dtype,
|
||||||
struct pg_tm * tm, fsec_t *fsec, int *tzp);
|
struct pg_tm *tm, fsec_t *fsec, int *tzp);
|
||||||
extern int DecodeTimeOnly(char **field, int *ftype,
|
extern int DecodeTimeOnly(char **field, int *ftype,
|
||||||
int nf, int *dtype,
|
int nf, int *dtype,
|
||||||
struct pg_tm * tm, fsec_t *fsec, int *tzp);
|
struct pg_tm *tm, fsec_t *fsec, int *tzp);
|
||||||
extern int DecodeInterval(char **field, int *ftype,
|
extern int DecodeInterval(char **field, int *ftype,
|
||||||
int nf, int *dtype,
|
int nf, int *dtype,
|
||||||
struct pg_tm * tm, fsec_t *fsec);
|
struct pg_tm *tm, fsec_t *fsec);
|
||||||
extern void DateTimeParseError(int dterr, const char *str,
|
extern void DateTimeParseError(int dterr, const char *str,
|
||||||
const char *datatype);
|
const char *datatype);
|
||||||
|
|
||||||
extern int DetermineLocalTimeZone(struct pg_tm * tm);
|
extern int DetermineLocalTimeZone(struct pg_tm *tm);
|
||||||
|
|
||||||
extern int EncodeDateOnly(struct pg_tm * tm, int style, char *str);
|
extern int EncodeDateOnly(struct pg_tm *tm, int style, char *str);
|
||||||
extern int EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, int *tzp, int style, char *str);
|
extern int EncodeTimeOnly(struct pg_tm *tm, fsec_t fsec, int *tzp, int style, char *str);
|
||||||
extern int EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, char *str);
|
extern int EncodeDateTime(struct pg_tm *tm, fsec_t fsec, int *tzp, char **tzn, int style, char *str);
|
||||||
extern int EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str);
|
extern int EncodeInterval(struct pg_tm *tm, fsec_t fsec, int style, char *str);
|
||||||
|
|
||||||
extern int DecodeSpecial(int field, char *lowtoken, int *val);
|
extern int DecodeSpecial(int field, char *lowtoken, int *val);
|
||||||
extern int DecodeUnits(int field, char *lowtoken, int *val);
|
extern int DecodeUnits(int field, char *lowtoken, int *val);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/include/utils/nabstime.h,v 1.46 2005/06/29 22:51:57 tgl Exp $
|
* $PostgreSQL: pgsql/src/include/utils/nabstime.h,v 1.47 2005/07/22 03:46:34 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -162,6 +162,6 @@ extern Datum timeofday(PG_FUNCTION_ARGS);
|
|||||||
|
|
||||||
/* non-fmgr-callable support routines */
|
/* non-fmgr-callable support routines */
|
||||||
extern AbsoluteTime GetCurrentAbsoluteTime(void);
|
extern AbsoluteTime GetCurrentAbsoluteTime(void);
|
||||||
extern void abstime2tm(AbsoluteTime time, int *tzp, struct pg_tm * tm, char **tzn);
|
extern void abstime2tm(AbsoluteTime time, int *tzp, struct pg_tm *tm, char **tzn);
|
||||||
|
|
||||||
#endif /* NABSTIME_H */
|
#endif /* NABSTIME_H */
|
||||||
|
@ -306,15 +306,15 @@ do { \
|
|||||||
|
|
||||||
int DecodeTimeOnly(char **field, int *ftype,
|
int DecodeTimeOnly(char **field, int *ftype,
|
||||||
int nf, int *dtype,
|
int nf, int *dtype,
|
||||||
struct tm * tm, fsec_t *fsec, int *tzp);
|
struct tm *tm, fsec_t *fsec, int *tzp);
|
||||||
|
|
||||||
int DecodeInterval(char **field, int *ftype,
|
int DecodeInterval(char **field, int *ftype,
|
||||||
int nf, int *dtype,
|
int nf, int *dtype,
|
||||||
struct tm * tm, fsec_t *fsec);
|
struct tm *tm, fsec_t *fsec);
|
||||||
|
|
||||||
int EncodeTimeOnly(struct tm * tm, fsec_t fsec, int *tzp, int style, char *str);
|
int EncodeTimeOnly(struct tm *tm, fsec_t fsec, int *tzp, int style, char *str);
|
||||||
int EncodeDateTime(struct tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, char *str, bool);
|
int EncodeDateTime(struct tm *tm, fsec_t fsec, int *tzp, char **tzn, int style, char *str, bool);
|
||||||
int EncodeInterval(struct tm * tm, fsec_t fsec, int style, char *str);
|
int EncodeInterval(struct tm *tm, fsec_t fsec, int style, char *str);
|
||||||
|
|
||||||
int tm2timestamp(struct tm *, fsec_t, int *, timestamp *);
|
int tm2timestamp(struct tm *, fsec_t, int *, timestamp *);
|
||||||
|
|
||||||
|
@ -686,7 +686,7 @@ DecodeSpecial(int field, char *lowtoken, int *val)
|
|||||||
* Encode date as local time.
|
* Encode date as local time.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
EncodeDateOnly(struct tm * tm, int style, char *str, bool EuroDates)
|
EncodeDateOnly(struct tm *tm, int style, char *str, bool EuroDates)
|
||||||
{
|
{
|
||||||
if (tm->tm_mon < 1 || tm->tm_mon > MONTHS_PER_YEAR)
|
if (tm->tm_mon < 1 || tm->tm_mon > MONTHS_PER_YEAR)
|
||||||
return -1;
|
return -1;
|
||||||
@ -766,7 +766,7 @@ TrimTrailingZeros(char *str)
|
|||||||
* European - dd/mm/yyyy
|
* European - dd/mm/yyyy
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
EncodeDateTime(struct tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, char *str, bool EuroDates)
|
EncodeDateTime(struct tm *tm, fsec_t fsec, int *tzp, char **tzn, int style, char *str, bool EuroDates)
|
||||||
{
|
{
|
||||||
int day,
|
int day,
|
||||||
hour,
|
hour,
|
||||||
@ -982,7 +982,7 @@ EncodeDateTime(struct tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, cha
|
|||||||
} /* EncodeDateTime() */
|
} /* EncodeDateTime() */
|
||||||
|
|
||||||
void
|
void
|
||||||
GetEpochTime(struct tm * tm)
|
GetEpochTime(struct tm *tm)
|
||||||
{
|
{
|
||||||
struct tm *t0;
|
struct tm *t0;
|
||||||
time_t epoch = 0;
|
time_t epoch = 0;
|
||||||
@ -1004,7 +1004,7 @@ GetEpochTime(struct tm * tm)
|
|||||||
} /* GetEpochTime() */
|
} /* GetEpochTime() */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char **tzn)
|
abstime2tm(AbsoluteTime _time, int *tzp, struct tm *tm, char **tzn)
|
||||||
{
|
{
|
||||||
time_t time = (time_t) _time;
|
time_t time = (time_t) _time;
|
||||||
struct tm *tx;
|
struct tm *tx;
|
||||||
@ -1085,7 +1085,7 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char **tzn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GetCurrentDateTime(struct tm * tm)
|
GetCurrentDateTime(struct tm *tm)
|
||||||
{
|
{
|
||||||
int tz;
|
int tz;
|
||||||
|
|
||||||
@ -1104,7 +1104,7 @@ GetCurrentDateTime(struct tm * tm)
|
|||||||
* the *only* call of mktime() in the backend.
|
* the *only* call of mktime() in the backend.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
DetermineLocalTimeZone(struct tm * tm)
|
DetermineLocalTimeZone(struct tm *tm)
|
||||||
{
|
{
|
||||||
int tz;
|
int tz;
|
||||||
|
|
||||||
@ -1269,7 +1269,7 @@ dt2time(double jd, int *hour, int *min, int *sec, fsec_t *fsec)
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
DecodeNumberField(int len, char *str, int fmask,
|
DecodeNumberField(int len, char *str, int fmask,
|
||||||
int *tmask, struct tm * tm, fsec_t *fsec, int *is2digits, bool EuroDates)
|
int *tmask, struct tm *tm, fsec_t *fsec, int *is2digits, bool EuroDates)
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
@ -1376,7 +1376,7 @@ int *tmask, struct tm * tm, fsec_t *fsec, int *is2digits, bool EuroDates)
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
DecodeNumber(int flen, char *str, int fmask,
|
DecodeNumber(int flen, char *str, int fmask,
|
||||||
int *tmask, struct tm * tm, fsec_t *fsec, int *is2digits, bool EuroDates)
|
int *tmask, struct tm *tm, fsec_t *fsec, int *is2digits, bool EuroDates)
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
char *cp;
|
char *cp;
|
||||||
@ -1484,7 +1484,7 @@ int *tmask, struct tm * tm, fsec_t *fsec, int *is2digits, bool EuroDates)
|
|||||||
* Insist on a complete set of fields.
|
* Insist on a complete set of fields.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
DecodeDate(char *str, int fmask, int *tmask, struct tm * tm, bool EuroDates)
|
DecodeDate(char *str, int fmask, int *tmask, struct tm *tm, bool EuroDates)
|
||||||
{
|
{
|
||||||
fsec_t fsec;
|
fsec_t fsec;
|
||||||
|
|
||||||
@ -1613,7 +1613,7 @@ DecodeDate(char *str, int fmask, int *tmask, struct tm * tm, bool EuroDates)
|
|||||||
* can be used to represent time spans.
|
* can be used to represent time spans.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
DecodeTime(char *str, int fmask, int *tmask, struct tm * tm, fsec_t *fsec)
|
DecodeTime(char *str, int fmask, int *tmask, struct tm *tm, fsec_t *fsec)
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
@ -1961,7 +1961,7 @@ ParseDateTime(char *timestr, char *lowstr,
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
DecodeDateTime(char **field, int *ftype, int nf,
|
DecodeDateTime(char **field, int *ftype, int nf,
|
||||||
int *dtype, struct tm * tm, fsec_t *fsec, int *tzp, bool EuroDates)
|
int *dtype, struct tm *tm, fsec_t *fsec, int *tzp, bool EuroDates)
|
||||||
{
|
{
|
||||||
int fmask = 0,
|
int fmask = 0,
|
||||||
tmask,
|
tmask,
|
||||||
|
@ -51,7 +51,7 @@ dt2local(timestamp dt, int tz)
|
|||||||
* Returns -1 on failure (overflow).
|
* Returns -1 on failure (overflow).
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
tm2timestamp(struct tm * tm, fsec_t fsec, int *tzp, timestamp *result)
|
tm2timestamp(struct tm *tm, fsec_t fsec, int *tzp, timestamp *result)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
int dDate;
|
int dDate;
|
||||||
@ -141,7 +141,7 @@ dt2time(timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec)
|
|||||||
* local time zone. If out of this range, leave as GMT. - tgl 97/05/27
|
* local time zone. If out of this range, leave as GMT. - tgl 97/05/27
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
timestamp2tm(timestamp dt, int *tzp, struct tm * tm, fsec_t *fsec, char **tzn)
|
timestamp2tm(timestamp dt, int *tzp, struct tm *tm, fsec_t *fsec, char **tzn)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
int dDate,
|
int dDate,
|
||||||
@ -381,7 +381,7 @@ PGTYPEStimestamp_current(timestamp *ts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dttofmtasc_replace(timestamp *ts, date dDate, int dow, struct tm * tm,
|
dttofmtasc_replace(timestamp *ts, date dDate, int dow, struct tm *tm,
|
||||||
char *output, int *pstr_len, char *fmtstr)
|
char *output, int *pstr_len, char *fmtstr)
|
||||||
{
|
{
|
||||||
union un_fmt_comb replace_val;
|
union un_fmt_comb replace_val;
|
||||||
|
Reference in New Issue
Block a user