예제 #1
0
static PyObject* astrology_swe_jdet_to_utc(PyObject *self, PyObject *args)
{
	double tjd_et;
	int calflag;

	if (!PyArg_ParseTuple(args, "di", &tjd_et, &calflag))
		return NULL;

	int y, m, d, h, mi;
	double s;

	swe_jdet_to_utc(tjd_et, calflag, &y, &m, &d, &h, &mi, &s);

	return Py_BuildValue("(iiiiid)", y, m, d, h, mi, s);
}
예제 #2
0
/*
 * Input:  tjd_ut   Julian day number, universal time (UT1).
 *         gregfalg Calendar flag
 * Output: UTC year, month, day, hour, minute, second (decimal).
 *
 * - Before 1 jan 1972 UTC, output UT1.
 *   Note: UTC was introduced in 1961. From 1961 - 1971, the length of the
 *   UTC second was regularly changed, so that UTC remained very close to UT1.
 * - From 1972 on, output is UTC.
 * - If delta_t - nleap - 32.184 > 1, the output is UT1.
 *   Note: Like this we avoid errors greater than 1 second in case that
 *   the leap seconds table (or the Swiss Ephemeris version) has not been
 *   updated for a long time.
 */
void FAR PASCAL_CONV swe_jdut1_to_utc(double tjd_ut, int32 gregflag, int32 *iyear, int32 *imonth, int32 *iday, int32 *ihour, int32 *imin, double *dsec) 
{
  double tjd_et = tjd_ut + swe_deltat(tjd_ut);
  swe_jdet_to_utc(tjd_et, gregflag, iyear, imonth, iday, ihour, imin, dsec);
}
예제 #3
0
파일: swedate.c 프로젝트: dwlnetnl/swego
/*
 * Input:  tjd_ut   Julian day number, universal time (UT1).
 *         gregfalg Calendar flag
 * Output: UTC year, month, day, hour, minute, second (decimal).
 *
 * - Before 1 jan 1972 UTC, output UT1.
 *   Note: UTC was introduced in 1961. From 1961 - 1971, the length of the
 *   UTC second was regularly changed, so that UTC remained very close to UT1.
 * - From 1972 on, output is UTC.
 * - If delta_t - nleap - 32.184 > 1, the output is UT1.
 *   Note: Like this we avoid errors greater than 1 second in case that
 *   the leap seconds table (or the Swiss Ephemeris version) has not been
 *   updated for a long time.
 */
void CALL_CONV swe_jdut1_to_utc(double tjd_ut, int32 gregflag, int32 *iyear, int32 *imonth, int32 *iday, int32 *ihour, int32 *imin, double *dsec) 
{
  double tjd_et = tjd_ut + swe_deltat_ex(tjd_ut, -1, NULL);
  swe_jdet_to_utc(tjd_et, gregflag, iyear, imonth, iday, ihour, imin, dsec);
}