Showing content from https://smithsonian.github.io/SuperNOVAS/apidoc/html/timescale_8c.html below:
SuperNOVAS: src/timescale.c File Reference
#define _GNU_SOURCE for strcasecmp()
double get_ut1_to_tt (int leap_seconds, double dut1) double get_utc_to_tt (int leap_seconds) double novas_date (const char *restrict date) double novas_date_scale (const char *restrict date, enum novas_timescale *restrict scale) double novas_diff_tcb (const novas_timespec *t1, const novas_timespec *t2) double novas_diff_tcg (const novas_timespec *t1, const novas_timespec *t2) double novas_diff_time (const novas_timespec *t1, const novas_timespec *t2) double novas_get_split_time (const novas_timespec *restrict time, enum novas_timescale timescale, long *restrict ijd) double novas_get_time (const novas_timespec *restrict time, enum novas_timescale timescale) time_t novas_get_unix_time (const novas_timespec *restrict time, long *restrict nanos) int novas_iso_timestamp (const novas_timespec *restrict time, char *restrict dst, int maxlen) int novas_offset_time (const novas_timespec *time, double seconds, novas_timespec *out) double novas_parse_date (const char *restrict date, char **restrict tail) double novas_parse_date_format (enum novas_calendar_type calendar, enum novas_date_format format, const char *restrict date, char **restrict tail) double novas_parse_iso_date (const char *restrict date, char **restrict tail) enum novas_timescale novas_parse_timescale (const char *restrict str, char **restrict tail) int novas_print_timescale (enum novas_timescale scale, char *restrict buf) int novas_set_split_time (enum novas_timescale timescale, long ijd, double fjd, int leap, double dut1, novas_timespec *restrict time) int novas_set_time (enum novas_timescale timescale, double jd, int leap, double dut1, novas_timespec *restrict time) int novas_set_unix_time (time_t unix_time, long nanos, int leap, double dut1, novas_timespec *restrict time) double novas_time_gst (const novas_timespec *restrict time, enum novas_accuracy accuracy) double novas_time_lst (const novas_timespec *restrict time, double lon, enum novas_accuracy accuracy) enum novas_timescale novas_timescale_for_string (const char *restrict str) int novas_timestamp (const novas_timespec *restrict time, enum novas_timescale scale, char *restrict dst, int maxlen) int tdb2tt (double jd_tdb, double *restrict jd_tt, double *restrict secdiff) double tt2tdb (double jd_tt) double tt2tdb_fp (double jd_tt, double limit) double tt2tdb_hp (double jd_tt)
-
Date
-
Created on Jun 24, 2024
-
Since
-
1.1
A set of SuperNOVAS routines to make handling of astronomical timescales and conversions among them easier.
-
See also
-
frames.c
◆ get_ut1_to_tt() double get_ut1_to_tt ( int leap_seconds, double dut1 )
Returns the TT - UT1 time difference given the leap seconds and the actual UT1 - UTC time difference as measured and published by IERS.
NOTES:
- The current UT1 - UTC time difference, and polar offsets, historical data and near-term projections are published in the <a href="https://www.iers.org/IERS/EN/Publications/Bulletins/bulletins.html>IERS Bulletins
-
Parameters
-
leap_seconds [s] Leap seconds at the time of observations dut1 [s] UT1 - UTC time difference [-0.5:0.5]
-
Returns
-
[s] The TT - UT1 time difference that is suitable for used with all calls in this library that require a
ut1_to_tt
argument.
-
See also
-
get_utc_to_tt()
-
place()
-
cel_pole()
-
Since
-
1.0
-
Author
-
Attila Kovacs
References get_utc_to_tt().
◆ get_utc_to_tt() double get_utc_to_tt ( int leap_seconds )
Returns the difference between Terrestrial Time (TT) and Universal Coordinated Time (UTC)
-
Parameters
-
leap_seconds [s] The current leap seconds (see IERS Bulletins)
-
Returns
-
[s] The TT - UTC time difference
-
See also
-
get_ut1_to_tt()
-
julian_date()
-
Since
-
1.0
-
Author
-
Attila Kovacs
References NOVAS_TAI_TO_TT.
◆ novas_date() double novas_date ( const char *restrict date )
Returns a Julian date (in non-specific timescale) corresponding the specified input string date/time. E.g. for "2025-02-28T09:41:12.041+0200", with some flexibility on how the date is represented as long as it's YMD date followed by HMS time. For other date formats (MDY or DMY) you can use novas_parse_date_format()
instead.
-
Parameters
-
date The date specification, possibly including time and timezone, in a standard format. See novas_parse_date() on more information on acceptable date/time formats.
-
Returns
-
[day] The Julian Day corresponding to the string date/time specification or NAN if the string is NULL or if it does not specify a date/time in the expected format.
-
Since
-
1.3
-
Author
-
Attila Kovacs
-
See also
-
novas_date_scale()
-
novas_parse_date()
-
novas_parse_date_format()
-
novas_iso_timestamp()
References novas_parse_date().
◆ novas_date_scale() double novas_date_scale ( const char *restrict date, enum novas_timescale *restrict scale )
Returns a Julian date and the timescale corresponding the specified input string date/time and timescale marker. E.g. for "2025-02-28T09:41:12.041+0200 TAI", with some flexibility on how the date is represented as long as it's YMD date followed by HMS time. For other date formats (MDY or DMY) you can use novas_parse_date_format()
instead.
-
Parameters
-
date The date specification, possibly including time and timezone, in a standard format. See novas_parse_date() on more information on acceptable date/time formats. [out] scale The timescale constant, or else -1 if the string could not be parsed into a date and timescale. If the string is a bare timestamp without an hint of a timescale marker, then NOVAS_UTC will be assumed.
-
Returns
-
[day] The Julian Day corresponding to the string date/time specification or NAN if the string is NULL or if it does not specify a date/time in the expected format.
-
Since
-
1.3
-
Author
-
Attila Kovacs
-
See also
-
novas_date()
-
novas_timestamp()
References novas_parse_date(), and novas_parse_timescale().
◆ novas_diff_tcb()
Returns the Barycentric Coordinate Time (TCB) based time difference (t1 - t2) in days between two astronomical time specifications. TCB progresses slightly faster than time on Earth, at a rate about 1.6×10-8 higher, due to the lack of gravitational time dilation by the Earth or Sun.
-
Parameters
-
t1 First time t2 Second time
-
Returns
-
[s] Precise TCB time difference (t1-t2), or NAN if one of the inputs was NULL (errno will be set to EINVAL)
-
See also
-
novas_diff_tcg()
-
novas_diff_time()
-
Since
-
1.1
-
Author
-
Attila Kovacs
References novas_diff_time().
◆ novas_diff_tcg()
Returns the Geocentric Coordinate Time (TCG) based time difference (t1 - t2) in days between two astronomical time specifications. TCG progresses slightly faster than time on Earth, at a rate about 7×10-10 higher, due to the lack of gravitational time dilation by Earth. TCG is an appropriate time measure for a spacecraft that is in the proximity of the orbit of Earth, but far enough from Earth such that the relativistic effects of Earth's gravity can be ignored.
-
Parameters
-
t1 First time t2 Second time
-
Returns
-
[s] Precise TCG time difference (t1-t2), or NAN if one of the inputs was NULL (errno will be set to EINVAL)
-
See also
-
novas_diff_tcb()
-
novas_diff_time()
-
Since
-
1.1
-
Author
-
Attila Kovacs
References novas_diff_time().
◆ novas_diff_time() ◆ novas_get_split_time()
Returns the fractional Julian date of an astronomical time in the specified timescale, as an integer and fractional part. The two-component split of the time allows for absolute precisions at the picosecond level, as opposed to novas_set_time()
, whose precision is limited to a few microseconds typically.
The accuracy of Barycentric Time measures (TDB and TCB) relative to other time measures is limited by the precision of the tbd2tt()
implemenation, to around 10 μs.
REFERENCES:
- IAU 1991, RECOMMENDATION III. XXIst General Assembly of the International Astronomical Union. Retrieved 6 June 2019.
- IAU 2006 resolution 3, see Recommendation and footnotes, note 3.
- Fairhead, L. & Bretagnon, P. (1990) Astron. & Astrophys. 229, 240.
- Kaplan, G. (2005), US Naval Observatory Circular 179.
- https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/req/time.html
- https://gssc.esa.int/navipedia/index.php/Transformations_between_Time_Systems
-
Parameters
-
time Pointer to the astronomical time specification data structure. timescale The astronomical time scale in which the returned Julian Date is to be provided [out] ijd [day] The integer part of the Julian date in the requested timescale. It may be NULL if not required.
-
Returns
-
[day] The fractional part of the Julian date in the requested timescale or NAN is the time argument is NULL (ijd will be set to -1 also).
-
See also
-
novas_set_split_time()
-
novas_get_time()
-
Since
-
1.1
-
Author
-
Attila Kovacs
References NOVAS_GPS, NOVAS_TAI, NOVAS_TCB, NOVAS_TCG, NOVAS_TDB, NOVAS_TT, NOVAS_UT1, and NOVAS_UTC.
◆ novas_get_time()
Returns the fractional Julian date of an astronomical time in the specified timescale. The returned time is accurate to a few μs (microsecond) due to the inherent precision of the double-precision result. For higher precision applications you may use novas_get_split_time()
instead, which has an inherent accuracy at the picosecond level.
-
Parameters
-
time Pointer to the astronomical time specification data structure. timescale The astronomical time scale in which the returned Julian Date is to be provided
-
Returns
-
[day] The Julian date in the requested timescale.
-
See also
-
novas_set_time()
-
novas_get_split_time()
-
Since
-
1.1
-
Author
-
Attila Kovacs
References novas_get_split_time().
◆ novas_get_unix_time() time_t novas_get_unix_time ( const novas_timespec *restrict time, long *restrict nanos )
Returns the UNIX time for an astronomical time instant.
-
Parameters
-
time Pointer to the astronomical time specification data structure. [out] nanos [ns] UTC sub-second component. It may be NULL if not required.
-
Returns
-
[s] The integer UNIX time, or -1 if the input time is NULL.
-
See also
-
novas_set_unix_time()
-
novas_get_time()
-
Since
-
1.1
-
Author
-
Attila Kovacs
References novas_get_split_time(), and NOVAS_UTC.
◆ novas_iso_timestamp() int novas_iso_timestamp ( const novas_timespec *restrict time, char *restrict dst, int maxlen )
Prints a UTC-based ISO timestamp to millisecond precision to the specified string buffer. E.g.:
2025-01-26T21:32:49.701Z
NOTES:
-
As per the ISO 8601 specification, the timestamp uses the Gregorian date, even for dates prior to the Gregorian calendar reform of 15 October 1582 (i.e. proleptic Gregorian dates).
- B.C. dates are indicated with years <=0 according to the astronomical and ISO 8601 convention, i.e., X B.C. as (1-X), so 45 B.C. as -44.
-
Parameters
-
time Pointer to the astronomical time specification data structure. [out] dst Output string buffer. At least 25 bytes are required for a complete timestamp with termination. maxlen The maximum number of characters that can be printed into the output buffer, including the string termination. If the full ISO timestamp is longer than
maxlen
, then it will be truncated to fit in the allotted space, including a termination character.
-
Returns
-
the number of characters printed into the string buffer, not including the termination. As such it is at most
maxlen - 1
.
-
Since
-
1.3
-
Author
-
Attila Kovacs
-
See also
-
novas_timestamp()
-
novas_parse_iso_date()
References novas_get_split_time(), NOVAS_GREGORIAN_CALENDAR, and NOVAS_UTC.
◆ novas_offset_time()
Increments the astrometric time by a given amount.
-
Parameters
-
time Original time specification seconds [s] Seconds to add to the original [out] out New incremented time specification. It may be the same as the input.
-
Returns
-
0 if successful, or else -1 if either the input or the output is NULL (errno will be set to EINVAL).
-
See also
-
novas_set_time()
-
novas_diff_time()
-
Since
-
1.1
-
Author
-
Attila Kovacs
References novas_timespec::fjd_tt, and novas_timespec::ijd_tt.
◆ novas_parse_date() double novas_parse_date ( const char *restrict date, char **restrict tail )
Parses an astronomical date/time string into a Julian date specification.
The date must be YMD-type with full year, followed the month (numerical or name or 3-letter abbreviation), and the day. The components may be separated by dash -
, underscore _
, dot .
, slash '/', or spaces/tabs, or any combination thereof. The date may be followed by a time specification in HMS format, separated from the date by the letter T
or t
, or spaces, comma ,
, or semicolon ;
, or underscore _
or a combination thereof. Finally, the time may be followed by the letter Z
, or z
(for UTC) or else {+/-}HH[:[MM]] time zone specification.
For example:
2025-01-26
2025 January 26
2025_Jan_26
2025-01-26T19:33:08Z
2025.01.26T19:33:08
2025 1 26 19h33m28.113
2025/1/26 19:33:28+02
2025-01-26T19:33:28-0600
2025 Jan 26 19:33:28+05:30
are all valid dates that can be parsed.
NOTES:
-
This function assumes Gregorian dates after their introduction on 1582 October 15, and Julian/Roman dates before that, as was the convention of the time. I.e., the day before of the introduction of the Gregorian calendar reform is 1582 October 4. I.e., you should not use this function with ISO 8601 timestamps containing dates prior to 1582 October 15 (for such date you may use novas_parse_iso_date()
instead).
- B.C. dates are indicated with years <=0 according to the astronomical and ISO 8601 convention, i.e., X B.C. as (1-X), so 45 B.C. as -44.
-
Parameters
-
date The astronomical date specification, possibly including time and timezone, in a standard format. The date is assumed to be in the astronomical calendar of date, which differs from ISO 8601 timestamps for dates prior to the Gregorian calendar reform of 1582 October 15 (otherwise, the two are identical). [out] tail (optional) If not NULL it will be set to the next character in the string after the parsed time.
-
Returns
-
[day] The Julian Day corresponding to the string date/time specification or NAN if the string is NULL or if it does not specify a date/time in the expected format.
-
Since
-
1.3
-
Author
-
Attila Kovacs
-
See also
-
novas_parse_iso_date()
-
novas_parse_date_format()
-
novas_date()
-
novas_date_scale()
-
novas_timescale_for_string()
-
novas_iso_timestamp()
-
novas_timestamp()
References NOVAS_ASTRONOMICAL_CALENDAR, novas_parse_date_format(), and NOVAS_YMD.
◆ novas_parse_date_format()
Parses a calndar date/time string, expressed in the specified type of calendar, into a Julian day (JD). The date must be composed of a full year (e.g. 2025), a month (numerical or name or 3-letter abbreviation, e.g. "01", "1", "January", or "Jan"), and a day (e.g. "08" or "8"). The components may be separated by dash -
, underscore _
, dot .
, slash '/', or spaces/tabs, or any combination thereof. The components will be parsed in the specified order.
The date may be followed by a time specification in HMS format, separated from the date by the letter T
or t
, or spaces, comma ,
, or semicolon ;
or underscore '_', or a combination thereof. Finally, the time may be followed by the letter Z
, or z
(for UTC) or else by a {+/-}HH[:[MM]] time zone specification.
For example, for format
NOVAS_YMD, all of the following strings may specify the date:
2025-01-26
2025 January 26
2025_Jan_26
2025-01-26T19:33:08Z
2025.01.26T19:33:08
2025 1 26 19h33m28.113
2025/1/26 19:33:28+02
2025-01-26T19:33:28-0600
2025 Jan 26 19:33:28+05:30
are all valid dates that can be parsed.
If your date format cannot be parsed with this function, you may parse it with your own function into year, month, day, and decimal hour-of-day components, and use julian_date() with those.
NOTES:
- B.C. dates are indicated with years <=0 according to the astronomical and ISO 8601 convention, i.e., X B.C. as (1-X), so 45 B.C. as -44.
-
Parameters
-
calendar The type of calendar to use: NOVAS_ASTRONOMICAL_CALENDAR, NOVAS_GREGORIAN_CALENDAR, or NOVAS_ROMAN_CALENDAR. format Expected order of date components: NOVAS_YMD, NOVAS_DMY, or NOVAS_MDY. date The date specification, possibly including time and timezone, in the specified standard format. [out] tail (optional) If not NULL it will be set to the next character in the string after the parsed time.
-
Returns
-
[day] The Julian Day corresponding to the string date/time specification or NAN if the string is NULL or if it does not specify a date/time in the expected format.
-
Since
-
1.3
-
Author
-
Attila Kovacs
-
See also
-
novas_parse_date()
-
novas_parse_iso_date()
-
novas_timescale_for_string()
-
novas_iso_timestamp()
-
julian_date()
References novas_debug(), NOVAS_DEBUG_OFF, NOVAS_DMY, novas_get_debug_mode(), novas_jd_from_date(), NOVAS_MDY, novas_parse_hms(), and NOVAS_YMD.
◆ novas_parse_iso_date() double novas_parse_iso_date ( const char *restrict date, char **restrict tail )
Parses an ISO 8601 timestamp, converting it to a Julian day. It is equivalent to novas_parse_date()
for dates after the Gregorian calendar reform of 1582. For earlier dates, ISO timestamps continue to assume the Gregorian calendar (i.e. proleptic Gregorian dates), whereas novas_parse_timestamp()
will assume Roman/Julian dates, which were conventionally used before the calendar reform.
NOTES:
- B.C. dates are indicated with years <=0 according to the astronomical and ISO 8601 convention, i.e., X B.C. as (1-X), so 45 B.C. as -44.
-
Parameters
-
date The ISO 8601 date specification, possibly including time and timezone, in a standard format. [out] tail (optional) If not NULL it will be set to the next character in the string after the parsed time.
-
Returns
-
[day] The Julian Day corresponding to the string date/time specification or NAN if the string is NULL or if it does not specify a date/time in the expected format.
-
Since
-
1.3
-
Author
-
Attila Kovacs
-
See also
-
novas_iso_timestamp()
-
novas_parse_date()
References NOVAS_GREGORIAN_CALENDAR, novas_parse_date_format(), and NOVAS_YMD.
◆ novas_parse_timescale() enum novas_timescale novas_parse_timescale ( const char *restrict str, char **restrict tail )
Parses the timescale from a string containing a standard abbreviation (case insensitive), and returns the updated parse position after the timescale specification (if any). The following timescale values are recognised: "UTC", "UT", "UT0", "UT1", "GMT", "TAI", "GPS", "TT", "ET", "TCG", "TCB", "TDB".
-
Parameters
-
str String specifying an astronomical timescale. Leading white spaces will be skipped over. [out] tail (optional) If not NULL it will be set to the next character in the string after the parsed timescale specification.
-
Returns
-
The SuperNOVAS timescale constant (<=0), or else -1 if the string was NULL, empty, or could not be matched to a timescale value (errno will be set to EINVAL also).
-
Since
-
1.3
-
Author
-
Attila Kovacs
-
See also
-
novas_timescale_for_string()
-
novas_set_time()
-
novas_set_split_time()
-
novas_print_timescale()
References novas_timescale_for_string(), and NOVAS_UTC.
◆ novas_print_timescale() int novas_print_timescale ( enum novas_timescale scale, char *restrict buf )
Prints the standard string representation of the timescale to the specified buffer. The string is terminated after. E.g. "UTC", or "TAI". It will print dates in the Gregorian calendar, which was introduced in was introduced on 15 October 1582 only. Thus the
-
Parameters
-
scale The timescale buf String in which to print. It should have at least 4-bytes of available storage.
-
Returns
-
the number of characters printed, not including termination, or else -1 if the timescale is invalid or the output buffer is NULL.
-
Since
-
1.3
-
Author
-
Attila Kovacs
-
See also
-
novas_timestamp()
-
novas_timescale_for_string()
References NOVAS_GPS, NOVAS_TAI, NOVAS_TCB, NOVAS_TCG, NOVAS_TDB, NOVAS_TT, NOVAS_UT1, and NOVAS_UTC.
◆ novas_set_split_time()
Sets an astronomical time to the split Julian Date value, defined in the specified timescale. The split into the integer and fractional parts can be done in any convenient way. The highest precision is reached if the fractional part is ≤ 1 day. In that case, the time may be specified to picosecond accuracy, if needed.
The accuracy of Barycentric Time measures (TDB and TCB) relative to other time measures is limited by the precision of tbd2tt()
implementation, to around 10 μs.
REFERENCES:
- IAU 1991, RECOMMENDATION III. XXIst General Assembly of the International Astronomical Union. Retrieved 6 June 2019.
- IAU 2006 resolution 3, see Recommendation and footnotes, note 3.
- Fairhead, L. & Bretagnon, P. (1990) Astron. & Astrophys. 229, 240.
- Kaplan, G. (2005), US Naval Observatory Circular 179.
- https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/req/time.html
- https://gssc.esa.int/navipedia/index.php/Transformations_between_Time_Systems
-
Parameters
-
timescale The astronomical time scale in which the Julian Date is given ijd [day] integer part of the Julian day in the specified timescale fjd [day] fractional part Julian day value in the specified timescale leap [s] Leap seconds, e.g. as published by IERS Bulletin C. dut1 [s] UT1-UTC time difference, e.g. as published in IERS Bulletin A. [out] time Pointer to the data structure that uniquely defines the astronomical time for all applications.
-
Returns
-
0 if successful, or else -1 if there was an error (errno will be set to indicate the type of error).
-
See also
-
novas_set_time()
-
novas_set_unix_time()
-
novas_get_split_time()
-
novas_timescale_for_string()
-
Since
-
1.1
-
Author
-
Attila Kovacs
References NOVAS_GPS, NOVAS_TAI, NOVAS_TCB, NOVAS_TCG, NOVAS_TDB, NOVAS_TT, NOVAS_UT1, NOVAS_UTC, and tt2tdb().
◆ novas_set_time()
Sets an astronomical time to the fractional Julian Date value, defined in the specified timescale. The time set this way is accurate to a few μs (microseconds) due to the inherent precision of the double-precision argument. For higher precision applications you may use novas_set_split_time()
instead, which has an inherent accuracy at the picosecond level.
-
Parameters
-
timescale The astronomical time scale in which the Julian Date is given jd [day] Julian day value in the specified timescale leap [s] Leap seconds, e.g. as published by IERS Bulletin C. dut1 [s] UT1-UTC time difference, e.g. as published in IERS Bulletin A. [out] time Pointer to the data structure that uniquely defines the astronomical time for all applications.
-
Returns
-
0 if successful, or else -1 if there was an error (errno will be set to indicate the type of error).
-
See also
-
novas_set_split_time()
-
novas_set_unix_time()
-
novas_get_time()
-
novas_timescale_for_string()
-
Since
-
1.1
-
Author
-
Attila Kovacs
References novas_set_split_time().
◆ novas_set_unix_time() int novas_set_unix_time ( time_t unix_time, long nanos, int leap, double dut1, novas_timespec *restrict time )
Sets an astronomical time to a UNIX time value. UNIX time is defined as UTC seconds measured since 0 UTC, 1 Jan 1970 (the start of the UNIX era). Specifying time this way supports precisions to the nanoseconds level by construct. Specifying UNIX time in split seconds and nanoseconds is a common way CLIB handles precision time, e.g. with struct timespec
and functions like clock_gettime()
(see time.h
).
-
Parameters
-
unix_time [s] UNIX time (UTC) seconds nanos [ns] UTC sub-second component leap [s] Leap seconds, e.g. as published by IERS Bulletin C. dut1 [s] UT1-UTC time difference, e.g. as published in IERS Bulletin A. [out] time Pointer to the data structure that uniquely defines the astronomical time for all applications.
-
Returns
-
0 if successful, or else -1 if there was an error (errno will be set to indicate the type of error).
-
See also
-
novas_set_time()
-
novas_get_unix_time()
-
clock_gettime()
-
struct timespec
-
Since
-
1.1
-
Author
-
Attila Kovacs
References novas_set_split_time(), and NOVAS_UTC.
◆ novas_time_gst() ◆ novas_time_lst()
Returns the Local (apparent) Sidereal Time (LST/LaST) for a given astronomical time specification and observer location.
-
Parameters
-
time The astronomoical time specification. lon [deg] The geodetic longitude of the observer. accuracy NOVAS_FULL_ACCURACY (0) or NOVAS_REDUCED_ACCURACY (1).
-
Returns
-
[h] The Local apparent Sidereal Time (LST / LaST) in the [0:24) hour range, or else NAN if there was an error (
errno
will indicate the type of error).
-
Since
-
1.4
-
Author
-
Attila Kovacs
-
See also
-
novas_frame_lst()
-
novas_set_time()
References novas_time_gst().
◆ novas_timescale_for_string() enum novas_timescale novas_timescale_for_string ( const char *restrict str )
Returns the timescale constant for a string that denotes the timescale in with a standard abbreviation (case insensitive). The following values are recognised: "UTC", "UT", "UT0", "UT1", "GMT", "TAI", "GPS", "TT", "ET", "TCG", "TCB", "TDB".
-
Parameters
-
str String specifying an astronomical timescale
-
Returns
-
The SuperNOVAS timescale constant (<=0), or else -1 if the string was NULL, empty, or could not be matched to a timescale value (errno will be set to EINVAL also).
-
Since
-
1.3
-
Author
-
Attila Kovacs
-
See also
-
novas_parse_timescale()
-
novas_set_time()
-
novas_set_split_time()
-
novas_print_timescale()
References NOVAS_GPS, NOVAS_TAI, NOVAS_TCB, NOVAS_TCG, NOVAS_TDB, NOVAS_TT, NOVAS_UT1, and NOVAS_UTC.
◆ novas_timestamp()
Prints an astronomical timestamp to millisecond precision in the specified timescale to the specified string buffer. It differs from ISO 8601 timestamps for dates prior to the Gregorian calendar reform of 1582 October 15 (otherwise two are identical). E.g.:
2025-01-26T21:32:49.701 TAI
NOTES:
-
The timestamp uses the astronomical date. That is Gregorian dates after the Gregorian calendar reform of 15 October 1582, and Julian/Roman dates prior to that. This is in contrast to ISO 8601 timestamps, which use Gregorian dates even for dates the precede the calendar reform that introduced them.
- B.C. dates are indicated with years <=0 according to the astronomical and ISO 8601 convention, i.e., X B.C. as (1-X), so 45 B.C. as -44.
-
Parameters
-
time Pointer to the astronomical time specification data structure. scale The timescale to use. [out] dst Output string buffer. At least 28 bytes are required for a complete timestamp with termination. maxlen The maximum number of characters that can be printed into the output buffer, including the string termination. If the full ISO timestamp is longer than
maxlen
, then it will be truncated to fit in the allotted space, including a termination character.
-
Returns
-
the number of characters printed into the string buffer, not including the termination. As such it is at most
maxlen - 1
.
-
Since
-
1.3
-
Author
-
Attila Kovacs
-
See also
-
novas_iso_timestamp()
-
novas_parse_date()
References NOVAS_ASTRONOMICAL_CALENDAR, novas_get_split_time(), and novas_print_timescale().
◆ tdb2tt() int tdb2tt ( double jd_tdb, double *restrict jd_tt, double *restrict secdiff )
Computes the Terrestrial Time (TT) based Julian date corresponding to a Barycentric Dynamical Time (TDB) Julian date, and retuns th TDB-TT time difference also. It has a maximum error of 10 μs between for dates 1600 and 2200.
This function is wrapped by tt2tdb()
, which is typically a lot easier to use as it returns the time difference directly, which can then be used to convert time in both directions with greater ease. For exable to convert a TT-based date to a TDB-based date:
double
TDB = TT +
tt2tdb
(TT) / 86400.0;
double tt2tdb(double jd_tt)
Definition timescale.c:178
is equivalent to:
double dt;
double TDB = TT + dt / 86400.0;
int tdb2tt(double jd_tdb, double *restrict jd_tt, double *restrict secdiff)
Definition timescale.c:133
NOTES:
- This function caches the results of the last calculation in case it may be re-used at no extra computational cost for the next call.
REFERENCES:
- Fairhead, L. & Bretagnon, P. (1990) Astron. & Astrophys. 229, 240.
- Kaplan, G. (2005), US Naval Observatory Circular 179.
-
Parameters
-
jd_tdb [day] Barycentric Dynamic Time (TDB) based Julian date. [out] jd_tt [day] Terrestrial Time (TT) based Julian date. (It may be NULL if not required) [out] secdiff [s] Difference 'tdb_jd'-'tt_jd', in seconds. (It may be NULL if not required)
-
Returns
-
0
-
See also
-
tt2tdb()
References NOVAS_JD_J2000.
◆ tt2tdb() double tt2tdb ( double jd_tt )
Returns the TDB - TT time difference in seconds for a given TT or TDB date, with a maximum error of 10 μs for dates between 1600 and 2200.
REFERENCES
- Fairhead, L. & Bretagnon, P. (1990) Astron. & Astrophys. 229, 240.
- Kaplan, G. (2005), US Naval Observatory Circular 179.
- Moyer, T.D. (1981), Celestial mechanics, Volume 23, Issue 1, pp. 57-68<.li>
-
Parameters
-
jd_tt [day] Terrestrial Time (TT) based Julian date, but Barycentri Dynamical Time (TDB) can also be used here without any loss of precision on the result.
-
Returns
-
[s] TDB - TT time difference.
-
See also
-
tt2tdb_hp()
-
tt2tdb_fp()
-
tdb2tt()
-
Since
-
1.0
-
Author
-
Attila Kovacs
References tdb2tt().
◆ tt2tdb_fp() double tt2tdb_fp ( double jd_tt, double limit )
Returns the TDB-TT time difference with flexible precision. This implementation uses the series expansion by Fairhead & Bretagnon 1990, terminating theterm at or below the specified limiting amplitude.
REFERENCES:
- Fairhead, L., & Bretagnon, P. (1990) A&A, 229, 240
-
Parameters
-
jd_tt [day] Terrestrial Time (TT) based Julian date, but Barycentric Dynamical Time (TDB) limit [us] Amplitude of limiting term to include in series. 0 or negative values will include all terms, producing the same result as
tt2tdb_hp()
.
-
Returns
-
[s] TDB - TT time difference.
-
Since
-
1.4
-
Author
-
Attila Kovacs
-
See also
-
tt2tdb_hp()
-
tt2tdb()
References NOVAS_JD_J2000.
◆ tt2tdb_hp() double tt2tdb_hp ( double jd_tt )
Returns the TDB-TT time difference with flexible precision. This implementation uses the full series expansion by Fairhead & Bretagnon 1990, resulting in an accuracy below 100 ns.
REFERENCES:
- Fairhead, L., & Bretagnon, P. (1990) A&A, 229, 240
-
Parameters
-
jd_tt [day] Terrestrial Time (TT) based Julian date, but Barycentric Dynamical Time (TDB)
-
Returns
-
[s] TDB - TT time difference.
-
Since
-
1.4
-
Author
-
Attila Kovacs
-
See also
-
tt2tdb_fp()
-
tt2tdb()
References tt2tdb_fp().
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4