Skip to content

Commit 7a724a0

Browse files
author
Thomas G. Lockhart
committed
Include some Julian date declarations to share between various date/time
modules. Used to be in dt.c I think.
1 parent 0925e5f commit 7a724a0

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

src/include/utils/dt.h

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
* Copyright (c) 1994, Regents of the University of California
1010
*
11-
* $Id: dt.h,v 1.34 1999/01/20 16:26:45 thomas Exp $
11+
* $Id: dt.h,v 1.35 1999/02/13 04:15:33 thomas Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -262,6 +262,29 @@ extern int datetime_is_epoch(double j);
262262
#define JROUND(j) (rint(((double) (j))*TIME_PREC_INV)/TIME_PREC_INV)
263263

264264

265+
266+
/*
267+
* Date/time validation
268+
* Include check for leap year.
269+
*/
270+
271+
extern int day_tab[2][13];
272+
273+
#define isleap(y) (((y % 4) == 0 && (y % 100) != 0) || (y % 400) == 0)
274+
275+
/* Julian date support for date2j() and j2date()
276+
* Set the minimum year to one greater than the year of the first valid day
277+
* to avoid having to check year and day both. - tgl 97/05/08
278+
*/
279+
280+
#define JULIAN_MINYEAR (-4713)
281+
#define JULIAN_MINMONTH (11)
282+
#define JULIAN_MINDAY (23)
283+
284+
#define IS_VALID_JULIAN(y,m,d) ((y > JULIAN_MINYEAR) \
285+
|| ((y == JULIAN_MINYEAR) && ((m > JULIAN_MINMONTH) \
286+
|| ((m == JULIAN_MINMONTH) && (d >= JULIAN_MINDAY)))))
287+
265288
/*
266289
* Date/time validation
267290
* Include check for leap year.

src/include/utils/int8.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: int8.h,v 1.8 1998/09/11 17:16:11 momjian Exp $
9+
* $Id: int8.h,v 1.9 1999/02/13 04:13:56 thomas Exp $
1010
*
1111
* NOTES
1212
* These data types are supported on all 64-bit architectures, and may
@@ -88,13 +88,16 @@ extern int64 *int48div(int32 val1, int64 * val2);
8888
extern int64 *int48(int32 val);
8989
extern int32 int84(int64 * val);
9090

91-
#if FALSE
91+
#if NOT_USED
9292
extern int64 *int28 (int16 val);
9393
extern int16 int82(int64 * val);
94-
9594
#endif
9695

9796
extern float64 i8tod(int64 * val);
9897
extern int64 *dtoi8(float64 val);
9998

99+
extern text *int8_text(int64 *val);
100+
extern int64 *text_int8(text *str);
101+
100102
#endif /* INT8_H */
103+

0 commit comments

Comments
 (0)