SNAP Library , Developer Reference
2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <tm.h>
Static Public Member Functions | |
static int | GetJulianDateN (int d, int m, int y) |
static void | GetCalendarDate (int jdn, int &dd, int &mm, int &yy) |
Static Public Attributes | |
static int | LastJulianDate = 15821004 |
static int | LastJulianDateN = 2299160 |
void TJulianDate::GetCalendarDate | ( | int | jdn, |
int & | dd, | ||
int & | mm, | ||
int & | yy | ||
) | [static] |
Definition at line 327 of file tm.cpp.
References LastJulianDateN.
Referenced by TSecTm::Round().
{ int julian = -1; long x, z, m, d, y; long daysPer400Years = 146097L; long fudgedDaysPer4000Years = 1460970L + 31; if (julian < 0){ /* set Julian flag if auto set */ julian = (jdn <= LastJulianDateN);} x = jdn + 68569L; if (julian){ x+=38; daysPer400Years = 146100L; fudgedDaysPer4000Years = 1461000L + 1; } z = 4 * x / daysPer400Years; x = x - (daysPer400Years * z + 3) / 4; y = 4000 * (x + 1) / fudgedDaysPer4000Years; x = x - 1461 * y / 4 + 31; m = 80 * x / 2447; d = x - 2447 * m / 80; x = m / 11; m = m + 2 - 12 * x; y = 100 * (z - 49) + y + x; yy = (int)y; mm = (int)m; dd = (int)d; if (yy <= 0){ /* adjust BC years */ (yy)--;} }
int TJulianDate::GetJulianDateN | ( | int | d, |
int | m, | ||
int | y | ||
) | [static] |
Definition at line 303 of file tm.cpp.
References IAssert, and LastJulianDate.
Referenced by TSecTm::GetInUnits(), and TSecTm::Round().
{ IAssert(y != 0); int julian = -1; long jdn; if (julian < 0){ /* set Julian flag if auto set */ julian = (((y * 100L) + m) * 100 + d <= LastJulianDate);} if (y < 0){ /* adjust BC year */ y++;} if (julian){ jdn = 367L * y - 7 * (y + 5001L + (m - 9) / 7) / 4 + 275 * m / 9 + d + 1729777L; } else { jdn = (long)(d - 32076) + 1461L * (y + 4800L + (m - 14) / 12) / 4 + 367 * (m - 2 - (m - 14) / 12 * 12) / 12 - 3 * ((y + 4900L + (m - 14) / 12) / 100) / 4 + 1; /* correction by rdg */ } return (int) jdn; }
int TJulianDate::LastJulianDate = 15821004 [static] |
Definition at line 71 of file tm.h.
Referenced by GetJulianDateN().
int TJulianDate::LastJulianDateN = 2299160 [static] |
Definition at line 72 of file tm.h.
Referenced by GetCalendarDate().