PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <time.h>
#include <ctype.h>
#include <limits.h>
#include "dt.h"
#include "pgtypes_date.h"
#include "pgtypes_error.h"
#include "pgtypeslib_extern.h"
Go to the source code of this file.
Macros | |
#define | PGTYPES_DATE_NUM_MAX_DIGITS |
#define | PGTYPES_FMTDATE_DAY_DIGITS_LZ 1 /* LZ means "leading zeroes" */ |
#define | PGTYPES_FMTDATE_DOW_LITERAL_SHORT 2 |
#define | PGTYPES_FMTDATE_MONTH_DIGITS_LZ 3 |
#define | PGTYPES_FMTDATE_MONTH_LITERAL_SHORT 4 |
#define | PGTYPES_FMTDATE_YEAR_DIGITS_SHORT 5 |
#define | PGTYPES_FMTDATE_YEAR_DIGITS_LONG 6 |
#define | PGTYPES_DATE_MONTH_MAXLENGTH 20 /* probably even less :-) */ |
Functions | |
date * | PGTYPESdate_new (void) |
void | PGTYPESdate_free (date *d) |
date | PGTYPESdate_from_timestamp (timestamp dt) |
date | PGTYPESdate_from_asc (char *str, char **endptr) |
char * | PGTYPESdate_to_asc (date dDate) |
void | PGTYPESdate_julmdy (date jd, int *mdy) |
void | PGTYPESdate_mdyjul (int *mdy, date *jdate) |
int | PGTYPESdate_dayofweek (date dDate) |
void | PGTYPESdate_today (date *d) |
int | PGTYPESdate_fmt_asc (date dDate, const char *fmtstring, char *outbuf) |
int | PGTYPESdate_defmt_asc (date *d, const char *fmt, const char *str) |
#define PGTYPES_DATE_MONTH_MAXLENGTH 20 /* probably even less :-) */ |
Definition at line 327 of file datetime.c.
#define PGTYPES_DATE_NUM_MAX_DIGITS |
Definition at line 157 of file datetime.c.
#define PGTYPES_FMTDATE_DAY_DIGITS_LZ 1 /* LZ means "leading zeroes" */ |
Definition at line 159 of file datetime.c.
#define PGTYPES_FMTDATE_DOW_LITERAL_SHORT 2 |
Definition at line 160 of file datetime.c.
#define PGTYPES_FMTDATE_MONTH_DIGITS_LZ 3 |
Definition at line 161 of file datetime.c.
#define PGTYPES_FMTDATE_MONTH_LITERAL_SHORT 4 |
Definition at line 162 of file datetime.c.
#define PGTYPES_FMTDATE_YEAR_DIGITS_LONG 6 |
Definition at line 164 of file datetime.c.
#define PGTYPES_FMTDATE_YEAR_DIGITS_SHORT 5 |
Definition at line 163 of file datetime.c.
int PGTYPESdate_dayofweek | ( | date | dDate | ) |
Definition at line 138 of file datetime.c.
References date2j().
Referenced by main(), PGTYPESdate_fmt_asc(), PGTYPEStimestamp_fmt_asc(), and rdayofweek().
int PGTYPESdate_defmt_asc | ( | date * | d, |
const char * | fmt, | ||
const char * | str | ||
) |
Definition at line 329 of file datetime.c.
References date2j(), fmt, free, i, j, sort-test::list, months, MONTHS_PER_YEAR, pg_tolower(), pgtypes_alloc(), PGTYPES_DATE_BAD_DAY, PGTYPES_DATE_BAD_MONTH, PGTYPES_DATE_ERR_EARGS, PGTYPES_DATE_ERR_ENOSHORTDATE, PGTYPES_DATE_ERR_ENOTDMY, PGTYPES_DATE_MONTH_MAXLENGTH, pgtypes_date_months, pgtypes_strdup(), str, tm, pg_tm::tm_mday, pg_tm::tm_mon, pg_tm::tm_year, and token.
Referenced by main(), and rdefmtdate().
int PGTYPESdate_fmt_asc | ( | date | dDate, |
const char * | fmtstring, | ||
char * | outbuf | ||
) |
Definition at line 167 of file datetime.c.
References date2j(), format, free, i, j2date(), months, pgtypes_alloc(), PGTYPES_DATE_NUM_MAX_DIGITS, pgtypes_date_weekdays_short, PGTYPES_FMTDATE_DAY_DIGITS_LZ, PGTYPES_FMTDATE_DOW_LITERAL_SHORT, PGTYPES_FMTDATE_MONTH_DIGITS_LZ, PGTYPES_FMTDATE_MONTH_LITERAL_SHORT, PGTYPES_FMTDATE_YEAR_DIGITS_LONG, PGTYPES_FMTDATE_YEAR_DIGITS_SHORT, PGTYPES_TYPE_STRING_CONSTANT, PGTYPES_TYPE_STRING_MALLOCED, PGTYPES_TYPE_UINT, PGTYPES_TYPE_UINT_2_LZ, PGTYPES_TYPE_UINT_4_LZ, PGTYPESdate_dayofweek(), snprintf, un_fmt_comb::str_val, tm, pg_tm::tm_mday, pg_tm::tm_mon, pg_tm::tm_year, and un_fmt_comb::uint_val.
Referenced by main(), and rfmtdate().
void PGTYPESdate_free | ( | date * | d | ) |
date PGTYPESdate_from_asc | ( | char * | str, |
char ** | endptr | ||
) |
Definition at line 47 of file datetime.c.
References date2j(), DecodeDateTime(), DTK_DATE, DTK_EPOCH, GetEpochTime(), MAXDATEFIELDS, MAXDATELEN, ParseDateTime(), PGTYPES_DATE_BAD_DATE, str, tm, pg_tm::tm_mday, pg_tm::tm_mon, and pg_tm::tm_year.
Referenced by ecpg_get_data(), and main().
Definition at line 31 of file datetime.c.
References TIMESTAMP_NOT_FINITE, and USECS_PER_DAY.
Referenced by main(), and PGTYPEStimestamp_fmt_asc().
void PGTYPESdate_julmdy | ( | date | jd, |
int * | mdy | ||
) |
void PGTYPESdate_mdyjul | ( | int * | mdy, |
date * | jdate | ||
) |
date* PGTYPESdate_new | ( | void | ) |
char* PGTYPESdate_to_asc | ( | date | dDate | ) |
Definition at line 101 of file datetime.c.
References buf, date2j(), DateStyle, EncodeDateOnly(), j2date(), MAXDATELEN, pgtypes_strdup(), tm, pg_tm::tm_mday, pg_tm::tm_mon, and pg_tm::tm_year.
Referenced by ecpg_store_input(), main(), and rdatestr().
void PGTYPESdate_today | ( | date * | d | ) |
Definition at line 148 of file datetime.c.
References date2j(), GetCurrentDateTime(), and tm.
Referenced by rtoday().