File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 88 *
99 * Copyright (c) 1994, Regents of the University of California
1010 *
11- * $Id: dt.h,v 1.33 1998/10/08 18:30:50 momjian Exp $
11+ * $Id: dt.h,v 1.33.2.1 1999/03/03 05:11:39 thomas Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -261,6 +261,29 @@ extern int datetime_is_epoch(double j);
261261#define TIME_PREC_INV 1000000.0
262262#define JROUND (j ) (rint(((double) (j))*TIME_PREC_INV)/TIME_PREC_INV)
263263
264+
265+ /*
266+ * Date/time validation
267+ * Include check for leap year.
268+ */
269+
270+ extern int day_tab [2 ][13 ];
271+
272+ #define isleap (y ) (((y % 4) == 0 && (y % 100) != 0) || (y % 400) == 0)
273+
274+ /* Julian date support for date2j() and j2date()
275+ * Set the minimum year to one greater than the year of the first valid day
276+ * to avoid having to check year and day both. - tgl 97/05/08
277+ */
278+
279+ #define JULIAN_MINYEAR (-4713)
280+ #define JULIAN_MINMONTH (11)
281+ #define JULIAN_MINDAY (23)
282+
283+ #define IS_VALID_JULIAN (y ,m ,d ) ((y > JULIAN_MINYEAR) \
284+ || ((y == JULIAN_MINYEAR) && ((m > JULIAN_MINMONTH) \
285+ || ((m == JULIAN_MINMONTH) && (d >= JULIAN_MINDAY)))))
286+
264287/*
265288 * dt.c prototypes
266289 */
You can’t perform that action at this time.
0 commit comments