Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5e73ab7

Browse files
author
Thomas G. Lockhart
committed
Move common date/time macros to a central place.
1 parentc569f2a commit5e73ab7

File tree

1 file changed

+24
-1
lines changed
  • src/include/utils

1 file changed

+24
-1
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.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 intdatetime_is_epoch(double j);
261261
#defineTIME_PREC_INV 1000000.0
262262
#defineJROUND(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+
externintday_tab[2][13];
271+
272+
#defineisleap(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+
#defineJULIAN_MINYEAR (-4713)
280+
#defineJULIAN_MINMONTH (11)
281+
#defineJULIAN_MINDAY (23)
282+
283+
#defineIS_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
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp