/* Convenience: a second, plus any fractional component */ #define DTK_ALL_SECS_M (DTK_M(SECOND) | DTK_M(MILLISECOND) | DTK_M(MICROSECOND)) #define DTK_DATE_M (DTK_M(YEAR) | DTK_M(MONTH) | DTK_M(DAY)) #define DTK_TIME_M (DTK_M(HOUR) | DTK_M(MINUTE) | DTK_ALL_SECS_M)
/* *Workingbuffersizeforinputandoutputofinterval,timestamp,etc. *Inputsthatneedmoreworkingspacewillberejectedearly.Longeroutputs *willoverrunbuffers,sothismustsufficeforallpossibleoutput.Asof *thiswriting,interval_out()needsthemostspaceat~90bytes.
*/ #define MAXDATELEN 128 /* maximum possible number of fields in a date string */ #define MAXDATEFIELDS 25 /* only this many chars are stored in datetktbl */ #define TOKMAXLEN 10
/* keep this struct small; it gets used a lot */ typedefstruct
{ char token[TOKMAXLEN + 1]; /* always NUL-terminated */ char type; /* see field type codes above */
int32 value; /* meaning depends on type */
} datetkn;
/* one of its uses is in tables of time zone abbreviations */ typedefstruct TimeZoneAbbrevTable
{
Size tblsize; /* size in bytes of TimeZoneAbbrevTable */ int numabbrevs; /* number of entries in abbrevs[] array */
datetkn abbrevs[FLEXIBLE_ARRAY_MEMBER]; /* DynamicZoneAbbrev(s) may follow the abbrevs[] array */
} TimeZoneAbbrevTable;
/* auxiliary data for a dynamic time zone abbreviation (non-fixed-offset) */ typedefstruct DynamicZoneAbbrev
{
pg_tz *tz; /* NULL if not yet looked up */ char zone[FLEXIBLE_ARRAY_MEMBER]; /* NUL-terminated zone name */
} DynamicZoneAbbrev;
typedefstruct DateTimeErrorExtra
{ /* Needed for DTERR_BAD_TIMEZONE and DTERR_BAD_ZONE_ABBREV: */ constchar *dtee_timezone; /* incorrect time zone name */ /* Needed for DTERR_BAD_ZONE_ABBREV: */ constchar *dtee_abbrev; /* relevant time zone abbreviation */
} DateTimeErrorExtra;
/* Result codes for DecodeTimezoneName() */ #define TZNAME_FIXED_OFFSET 0 #define TZNAME_DYNTZ 1 #define TZNAME_ZONE 2
externvoid GetCurrentDateTime(struct pg_tm *tm); externvoid GetCurrentTimeUsec(struct pg_tm *tm, fsec_t *fsec, int *tzp); externvoid j2date(int jd, int *year, int *month, int *day); externint date2j(int year, int month, int day);
externint ParseDateTime(constchar *timestr, char *workbuf, size_t buflen, char **field, int *ftype, int maxfields, int *numfields); externint DecodeDateTime(char **field, int *ftype, int nf, int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp,
DateTimeErrorExtra *extra); externint DecodeTimezone(constchar *str, int *tzp); externint DecodeTimeOnly(char **field, int *ftype, int nf, int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp,
DateTimeErrorExtra *extra); externint DecodeInterval(char **field, int *ftype, int nf, int range, int *dtype, struct pg_itm_in *itm_in); externint DecodeISO8601Interval(char *str, int *dtype, struct pg_itm_in *itm_in);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.