Download pgsql/include/server/utils/date.h from codekingpro/portable-devtools: direct link, hf CLI and curl.
- Browser
- Download file 3.45 kB
-
https://huggingface.co/datasets/codekingpro/portable-devtools/resolve/df58e70f9edde36aaca2d2aacc2440dd6c2f807d/pgsql/include/server/utils/date.h
- Command line
-
hf download hf://datasets/codekingpro/portable-devtools@df58e70f9edde36aaca2d2aacc2440dd6c2f807d/pgsql/include/server/utils/date.h
-
curl -L -o date.h https://huggingface.co/datasets/codekingpro/portable-devtools/resolve/df58e70f9edde36aaca2d2aacc2440dd6c2f807d/pgsql/include/server/utils/date.h
3.45 kB
| /*------------------------------------------------------------------------- | |
| * | |
| * date.h | |
| * Definitions for the SQL "date" and "time" types. | |
| * | |
| * | |
| * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group | |
| * Portions Copyright (c) 1994, Regents of the University of California | |
| * | |
| * src/include/utils/date.h | |
| * | |
| *------------------------------------------------------------------------- | |
| */ | |
| typedef int32 DateADT; | |
| typedef int64 TimeADT; | |
| typedef struct | |
| { | |
| TimeADT time; /* all time units other than months and years */ | |
| int32 zone; /* numeric time zone, in seconds */ | |
| } TimeTzADT; | |
| /* | |
| * Infinity and minus infinity must be the max and min values of DateADT. | |
| */ | |
| /* | |
| * Functions for fmgr-callable functions. | |
| * | |
| * For TimeADT, we make use of the same support routines as for int64. | |
| * Therefore TimeADT is pass-by-reference if and only if int64 is! | |
| */ | |
| static inline DateADT | |
| DatumGetDateADT(Datum X) | |
| { | |
| return (DateADT) DatumGetInt32(X); | |
| } | |
| static inline TimeADT | |
| DatumGetTimeADT(Datum X) | |
| { | |
| return (TimeADT) DatumGetInt64(X); | |
| } | |
| static inline TimeTzADT * | |
| DatumGetTimeTzADTP(Datum X) | |
| { | |
| return (TimeTzADT *) DatumGetPointer(X); | |
| } | |
| static inline Datum | |
| DateADTGetDatum(DateADT X) | |
| { | |
| return Int32GetDatum(X); | |
| } | |
| static inline Datum | |
| TimeADTGetDatum(TimeADT X) | |
| { | |
| return Int64GetDatum(X); | |
| } | |
| static inline Datum | |
| TimeTzADTPGetDatum(const TimeTzADT *X) | |
| { | |
| return PointerGetDatum(X); | |
| } | |
| /* date.c */ | |
| extern int32 anytime_typmod_check(bool istz, int32 typmod); | |
| extern double date2timestamp_no_overflow(DateADT dateVal); | |
| extern Timestamp date2timestamp_opt_overflow(DateADT dateVal, int *overflow); | |
| extern TimestampTz date2timestamptz_opt_overflow(DateADT dateVal, int *overflow); | |
| extern int32 date_cmp_timestamp_internal(DateADT dateVal, Timestamp dt2); | |
| extern int32 date_cmp_timestamptz_internal(DateADT dateVal, TimestampTz dt2); | |
| extern void EncodeSpecialDate(DateADT dt, char *str); | |
| extern DateADT GetSQLCurrentDate(void); | |
| extern TimeTzADT *GetSQLCurrentTime(int32 typmod); | |
| extern TimeADT GetSQLLocalTime(int32 typmod); | |
| extern int time2tm(TimeADT time, struct pg_tm *tm, fsec_t *fsec); | |
| extern int timetz2tm(TimeTzADT *time, struct pg_tm *tm, fsec_t *fsec, int *tzp); | |
| extern int tm2time(struct pg_tm *tm, fsec_t fsec, TimeADT *result); | |
| extern int tm2timetz(struct pg_tm *tm, fsec_t fsec, int tz, TimeTzADT *result); | |
| extern bool time_overflows(int hour, int min, int sec, fsec_t fsec); | |
| extern bool float_time_overflows(int hour, int min, double sec); | |
| extern void AdjustTimeForTypmod(TimeADT *time, int32 typmod); | |