Add function gswe_timestamp_get_sidereal_time()

This commit is contained in:
Gergely Polonkai 2014-06-11 15:59:55 +02:00
parent fbf341dcec
commit 95face8294
3 changed files with 34 additions and 0 deletions

View File

@ -268,6 +268,7 @@ gswe_timestamp_set_julian_day_et
gswe_timestamp_get_julian_day_et
gswe_timestamp_set_julian_day_ut
gswe_timestamp_get_julian_day_ut
gswe_timestamp_get_sidereal_time
<SUBSECTION Standard>
GSWE_IS_TIMESTAMP
GSWE_IS_TIMESTAMP_CLASS

View File

@ -985,6 +985,38 @@ gswe_timestamp_get_julian_day_ut(GsweTimestamp *timestamp, GError **err)
return timestamp->priv->julian_day_ut;
}
/**
* gswe_timestamp_get_sidereal_time:
* @timestamp: a GsweTimestamp
* @err: a #GError
*
* Gets the sidereal time on the Greenwich Meridian.
*
* Returns: the sidereal time in hours. To get the degrees, multiply this value
* by 15.
*
* Since: 2.1
*/
gdouble
gswe_timestamp_get_sidereal_time(GsweTimestamp *timestamp, GError **err)
{
GError *local_err = NULL;
gswe_timestamp_calculate_julian(timestamp, &local_err);
if (local_err) {
if (err) {
*err = local_err;
} else {
g_error_free(local_err);
}
return 0.0;
}
return swe_sidtime(timestamp->priv->julian_day_ut);
}
/**
* gswe_timestamp_new:
*

View File

@ -119,6 +119,7 @@ void gswe_timestamp_set_julian_day_et(GsweTimestamp *timestamp, gdouble julian_d
gdouble gswe_timestamp_get_julian_day_et(GsweTimestamp *timestamp, GError **err);
void gswe_timestamp_set_julian_day_ut(GsweTimestamp *timestamp, gdouble julian_day, GError **err);
gdouble gswe_timestamp_get_julian_day_ut(GsweTimestamp *timestamp, GError **err);
gdouble gswe_timestamp_get_sidereal_time(GsweTimestamp *timestamp, GError **err);
#endif /* __SWE_GLIB_GSWE_TIMESTAMP_H__ */