Implement "date/time grand unification".
Transform datetime and timespan into timestamp and interval.
Deprecate datetime and timespan, though translate to new types in gram.y.
Transform all datetime and timespan catalog entries into new types.
Make "INTERVAL" reserved word allowed as a column identifier in gram.y.
Remove dt.h, dt.c files, and retarget datetime.h, datetime.c as utility
routines for all date/time types.
date.{h,c} now deals with date, time types.
timestamp.{h,c} now deals with timestamp, interval types.
nabstime.{h,c} now deals with abstime, reltime, tinterval types.
Make NUMERIC a known native type for purposes of type coersion. Not tested.
2000-02-16 18:26:26 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* date.h
|
|
|
|
* Definitions for the SQL92 "date" and "time" types.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
2000-03-15 00:06:59 +01:00
|
|
|
* $Id: date.h,v 1.2 2000/03/14 23:06:50 thomas Exp $
|
Implement "date/time grand unification".
Transform datetime and timespan into timestamp and interval.
Deprecate datetime and timespan, though translate to new types in gram.y.
Transform all datetime and timespan catalog entries into new types.
Make "INTERVAL" reserved word allowed as a column identifier in gram.y.
Remove dt.h, dt.c files, and retarget datetime.h, datetime.c as utility
routines for all date/time types.
date.{h,c} now deals with date, time types.
timestamp.{h,c} now deals with timestamp, interval types.
nabstime.{h,c} now deals with abstime, reltime, tinterval types.
Make NUMERIC a known native type for purposes of type coersion. Not tested.
2000-02-16 18:26:26 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef DATE_H
|
|
|
|
#define DATE_H
|
|
|
|
|
|
|
|
typedef int32 DateADT;
|
|
|
|
|
|
|
|
typedef float8 TimeADT;
|
|
|
|
|
2000-03-15 00:06:59 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
double time; /* all time units other than months and years */
|
|
|
|
int4 zone; /* numeric time zone, in seconds */
|
|
|
|
} TimeTzADT;
|
|
|
|
|
Implement "date/time grand unification".
Transform datetime and timespan into timestamp and interval.
Deprecate datetime and timespan, though translate to new types in gram.y.
Transform all datetime and timespan catalog entries into new types.
Make "INTERVAL" reserved word allowed as a column identifier in gram.y.
Remove dt.h, dt.c files, and retarget datetime.h, datetime.c as utility
routines for all date/time types.
date.{h,c} now deals with date, time types.
timestamp.{h,c} now deals with timestamp, interval types.
nabstime.{h,c} now deals with abstime, reltime, tinterval types.
Make NUMERIC a known native type for purposes of type coersion. Not tested.
2000-02-16 18:26:26 +01:00
|
|
|
/* date.c */
|
|
|
|
extern DateADT date_in(char *datestr);
|
|
|
|
extern char *date_out(DateADT dateVal);
|
|
|
|
extern bool date_eq(DateADT dateVal1, DateADT dateVal2);
|
|
|
|
extern bool date_ne(DateADT dateVal1, DateADT dateVal2);
|
|
|
|
extern bool date_lt(DateADT dateVal1, DateADT dateVal2);
|
|
|
|
extern bool date_le(DateADT dateVal1, DateADT dateVal2);
|
|
|
|
extern bool date_gt(DateADT dateVal1, DateADT dateVal2);
|
|
|
|
extern bool date_ge(DateADT dateVal1, DateADT dateVal2);
|
|
|
|
extern int date_cmp(DateADT dateVal1, DateADT dateVal2);
|
|
|
|
extern DateADT date_larger(DateADT dateVal1, DateADT dateVal2);
|
|
|
|
extern DateADT date_smaller(DateADT dateVal1, DateADT dateVal2);
|
|
|
|
extern int32 date_mi(DateADT dateVal1, DateADT dateVal2);
|
|
|
|
extern DateADT date_pli(DateADT dateVal, int32 days);
|
|
|
|
extern DateADT date_mii(DateADT dateVal, int32 days);
|
|
|
|
extern Timestamp *date_timestamp(DateADT date);
|
|
|
|
extern DateADT timestamp_date(Timestamp *timestamp);
|
|
|
|
extern Timestamp *datetime_timestamp(DateADT date, TimeADT *time);
|
|
|
|
extern DateADT abstime_date(AbsoluteTime abstime);
|
|
|
|
|
|
|
|
extern TimeADT *time_in(char *timestr);
|
|
|
|
extern char *time_out(TimeADT *time);
|
|
|
|
extern bool time_eq(TimeADT *time1, TimeADT *time2);
|
|
|
|
extern bool time_ne(TimeADT *time1, TimeADT *time2);
|
|
|
|
extern bool time_lt(TimeADT *time1, TimeADT *time2);
|
|
|
|
extern bool time_le(TimeADT *time1, TimeADT *time2);
|
|
|
|
extern bool time_gt(TimeADT *time1, TimeADT *time2);
|
|
|
|
extern bool time_ge(TimeADT *time1, TimeADT *time2);
|
2000-03-15 00:06:59 +01:00
|
|
|
extern int time_cmp(TimeADT *time1, TimeADT *time2);
|
|
|
|
extern bool overlaps_time(TimeADT *time1, TimeADT *time2,
|
|
|
|
TimeADT *time3, TimeADT *time4);
|
|
|
|
extern TimeADT *time_larger(TimeADT *time1, TimeADT *time2);
|
|
|
|
extern TimeADT *time_smaller(TimeADT *time1, TimeADT *time2);
|
Implement "date/time grand unification".
Transform datetime and timespan into timestamp and interval.
Deprecate datetime and timespan, though translate to new types in gram.y.
Transform all datetime and timespan catalog entries into new types.
Make "INTERVAL" reserved word allowed as a column identifier in gram.y.
Remove dt.h, dt.c files, and retarget datetime.h, datetime.c as utility
routines for all date/time types.
date.{h,c} now deals with date, time types.
timestamp.{h,c} now deals with timestamp, interval types.
nabstime.{h,c} now deals with abstime, reltime, tinterval types.
Make NUMERIC a known native type for purposes of type coersion. Not tested.
2000-02-16 18:26:26 +01:00
|
|
|
extern TimeADT *timestamp_time(Timestamp *timestamp);
|
2000-03-15 00:06:59 +01:00
|
|
|
extern Interval *time_interval(TimeADT *time);
|
|
|
|
|
|
|
|
extern TimeTzADT *timetz_in(char *timestr);
|
|
|
|
extern char *timetz_out(TimeTzADT *time);
|
|
|
|
extern bool timetz_eq(TimeTzADT *time1, TimeTzADT *time2);
|
|
|
|
extern bool timetz_ne(TimeTzADT *time1, TimeTzADT *time2);
|
|
|
|
extern bool timetz_lt(TimeTzADT *time1, TimeTzADT *time2);
|
|
|
|
extern bool timetz_le(TimeTzADT *time1, TimeTzADT *time2);
|
|
|
|
extern bool timetz_gt(TimeTzADT *time1, TimeTzADT *time2);
|
|
|
|
extern bool timetz_ge(TimeTzADT *time1, TimeTzADT *time2);
|
|
|
|
extern int timetz_cmp(TimeTzADT *time1, TimeTzADT *time2);
|
|
|
|
extern bool overlaps_timetz(TimeTzADT *time1, TimeTzADT *time2,
|
|
|
|
TimeTzADT *time3, TimeTzADT *time4);
|
|
|
|
extern TimeTzADT *timetz_larger(TimeTzADT *time1, TimeTzADT *time2);
|
|
|
|
extern TimeTzADT *timetz_smaller(TimeTzADT *time1, TimeTzADT *time2);
|
|
|
|
extern TimeTzADT *timestamp_timetz(Timestamp *timestamp);
|
|
|
|
extern Timestamp *datetimetz_timestamp(DateADT date, TimeTzADT *time);
|
Implement "date/time grand unification".
Transform datetime and timespan into timestamp and interval.
Deprecate datetime and timespan, though translate to new types in gram.y.
Transform all datetime and timespan catalog entries into new types.
Make "INTERVAL" reserved word allowed as a column identifier in gram.y.
Remove dt.h, dt.c files, and retarget datetime.h, datetime.c as utility
routines for all date/time types.
date.{h,c} now deals with date, time types.
timestamp.{h,c} now deals with timestamp, interval types.
nabstime.{h,c} now deals with abstime, reltime, tinterval types.
Make NUMERIC a known native type for purposes of type coersion. Not tested.
2000-02-16 18:26:26 +01:00
|
|
|
|
|
|
|
#endif /* DATE_H */
|
2000-03-15 00:06:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
|