diff options
| author | Marc G. Fournier <scrappy@hub.org> | 1997-04-02 18:36:24 +0000 |
|---|---|---|
| committer | Marc G. Fournier <scrappy@hub.org> | 1997-04-02 18:36:24 +0000 |
| commit | 2ab34dfe1a7c2fecf158a4e5e042c3f971a46ab0 (patch) | |
| tree | 242770c813c27be51c734da1a057510e620f8014 /src/include/utils/builtins.h | |
| parent | 920c58df71f2dd02b0221dd89e0b7dfc57f8c778 (diff) | |
| download | postgresql-2ab34dfe1a7c2fecf158a4e5e042c3f971a46ab0.tar.gz | |
From: Thomas Lockhart <Thomas.G.Lockhart@jpl.nasa.gov>
Subject: [HACKERS] More date time functions
Here are some additional patches mostly related to the date and time
data types. It includes some type conversion routines to move between
the different date types and some other date manipulation routines such
as date_part(units,datetime).
I noticed Edmund Mergl et al's neat trick for getting function overloading
for builtin functions, so started to use that for the date and time stuff.
Later, if someone figures out how to get function overloading directly
for internal C code, then we can move to that technique.
These patches include documentation updates (don't faint!) for the built-in
man page. Doesn't yet include mention of timestamp, since I don't know
much about it and since it may change a bit to become a _real_ ANSI timestamp
which would include parser support for the declaration syntax (what do you
think, Dan?).
The patches were developed on the 970330 release, but have been rebuilt
off of the 970402 release. The first patch below is to get libpq to compile,
on my Linux box, but is not related to the rest of the patches and you can
choose not to apply that one at this time. Thanks in advance, scrappy!
Diffstat (limited to 'src/include/utils/builtins.h')
| -rw-r--r-- | src/include/utils/builtins.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index 680566d6a3..7d780b7fc1 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: builtins.h,v 1.13 1997/03/25 09:25:33 scrappy Exp $ + * $Id: builtins.h,v 1.14 1997/04/02 18:31:52 scrappy Exp $ * * NOTES * This should normally only be included by fmgr.h. @@ -224,6 +224,8 @@ extern int32 reltimein(char *timestring); extern char *reltimeout(int32 timevalue); extern TimeInterval tintervalin(char *intervalstr); extern char *tintervalout(TimeInterval interval); +extern RelativeTime timespan_reltime(TimeSpan *timespan); +extern TimeSpan *reltime_timespan(RelativeTime reltime); extern TimeInterval mktinterval(AbsoluteTime t1, AbsoluteTime t2); extern AbsoluteTime timepl(AbsoluteTime t1, RelativeTime t2); extern AbsoluteTime timemi(AbsoluteTime t1, RelativeTime t2); @@ -416,6 +418,7 @@ bool timestamplt(time_t t1, time_t t2); bool timestampgt(time_t t1, time_t t2); bool timestample(time_t t1, time_t t2); bool timestampge(time_t t1, time_t t2); +DateTime *timestamp_datetime(time_t timestamp); /* varchar.c */ extern char *bpcharin(char *s, int dummy, int typlen); @@ -476,6 +479,10 @@ 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 DateTime *date_datetime(DateADT date); +extern DateADT datetime_date(DateTime *datetime); +extern DateTime *datetime_datetime(DateADT date, TimeADT *time); +extern DateADT abstime_date(AbsoluteTime abstime); #else @@ -493,6 +500,10 @@ extern int4 date_smaller(int4 dateVal1, int4 dateVal2); extern int32 date_mi(int4 dateVal1, int4 dateVal2); extern int4 date_pli(int4 dateVal, int32 days); extern int4 date_mii(int4 dateVal, int32 days); +extern DateTime *date_datetime(int4 date); +extern int4 datetime_date(DateTime *datetime); +extern DateTime *datetime_datetime(int4 date, TimeADT *time); +extern int4 abstime_date(AbsoluteTime abstime); #endif |
