KStarsDateTime
#include <kstarsdatetime.h>
Public Types | |
enum | EpochType { JULIAN , BESSELIAN } |
Public Types inherited from QDateTime | |
enum | YearRange |
Static Public Attributes | |
static constexpr const double | B1900 = 2415020.31352 |
static constexpr const double | JD_PER_BYEAR = 365.242198781 |
Additional Inherited Members | |
Public Attributes inherited from QDateTime | |
First | |
Last | |
Detailed Description
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day, using a long double, in which the fractional portion encodes the time of day to a precision of a less than a second.
Also adds Greenwich Sidereal Time and "epoch", which is just the date expressed as a floating point number representing the year, with the fractional part representing the date and time (with poor time resolution; typically the Epoch is only taken to the hundredths place, which is a few days).
- Note
- Local time and Local sideral time are not handled here. Because they depend on the geographic location, they are part of the GeoLocation class.
- The default timespec is UTC unless the passed value has different timespec value.
- See also
- GeoLocation::GSTtoLST()
- GeoLocation::UTtoLT()
- Version
- 1.1
Definition at line 35 of file kstarsdatetime.h.
Member Enumeration Documentation
◆ EpochType
description options
- Note
- After 1976, the IAU standard for epochs is Julian Years.
Enumerator | |
---|---|
JULIAN | Julian epoch (see http://scienceworld.wolfram.com/astronomy/JulianEpoch.html) |
BESSELIAN | Besselian epoch (see http://scienceworld.wolfram.com/astronomy/BesselianEpoch.html) |
Definition at line 185 of file kstarsdatetime.h.
Constructor & Destructor Documentation
◆ KStarsDateTime() [1/5]
KStarsDateTime::KStarsDateTime | ( | ) |
Default constructor Creates a date/time at J2000 (noon on Jan 1, 200)
- Note
- This sets the timespec to UTC.
Definition at line 16 of file kstarsdatetime.cpp.
◆ KStarsDateTime() [2/5]
|
explicit |
Constructor Creates a date/time at the specified Julian Day.
jd
The Julian Day
- Note
- This sets the timespec to UTC.
Definition at line 66 of file kstarsdatetime.cpp.
◆ KStarsDateTime() [3/5]
KStarsDateTime::KStarsDateTime | ( | const KStarsDateTime & | kdt | ) |
Copy constructor kdt
The KStarsDateTime object to copy.
- Note
- The timespec is copied from kdt.
Definition at line 22 of file kstarsdatetime.cpp.
◆ KStarsDateTime() [4/5]
Copy constructor qdt
The QDateTime object to copy.
- Note
- The timespec is copied from qdt.
Definition at line 46 of file kstarsdatetime.cpp.
◆ KStarsDateTime() [5/5]
KStarsDateTime::KStarsDateTime | ( | const QDate & | _d, |
const QTime & | _t, | ||
Qt::TimeSpec | timeSpec = Qt::UTC ) |
Constructor Create a KStarsDateTimne based on the specified Date and Time.
_d
The QDate to assign _t
The QTime to assign timespec
The desired timespec, UTC by default.
Definition at line 57 of file kstarsdatetime.cpp.
Member Function Documentation
◆ addDays()
|
inline |
Modify the Date/Time by adding a number of days.
nd
the number of days to add. The number can be negative.
Definition at line 110 of file kstarsdatetime.h.
◆ addSecs()
KStarsDateTime KStarsDateTime::addSecs | ( | double | s | ) | const |
- Returns
- a KStarsDateTime that is the given number of seconds later than this KStarsDateTime.
s
the number of seconds to add. The number can be negative.
Definition at line 153 of file kstarsdatetime.cpp.
◆ currentDateTime()
|
static |
- Returns
- the date and time according to the CPU clock
Definition at line 73 of file kstarsdatetime.cpp.
◆ currentDateTimeUtc()
|
static |
- Returns
- the UTC date and time according to the CPU clock
Definition at line 82 of file kstarsdatetime.cpp.
◆ djd()
|
inline |
- Returns
- the julian day as a long double, including the time as the fractional portion.
Definition at line 163 of file kstarsdatetime.h.
◆ epoch()
|
inline |
This is (approximately) the year expressed as a floating-point value.
- Returns
- the (Julian) epoch value of the Date/Time.
- See also
- setFromEpoch()
- Note
- The definition of Julian Epoch used here comes from http://scienceworld.wolfram.com/astronomy/JulianEpoch.html
Definition at line 197 of file kstarsdatetime.h.
◆ epochToJd()
Takes in an epoch and returns a Julian Date.
- Returns
- the Julian Date (date with fraction)
- Parameters
-
epoch A floating-point year value specifying the Epoch type JULIAN or BESSELIAN depending on what convention the epoch is specified in
Definition at line 256 of file kstarsdatetime.cpp.
◆ fromString()
|
static |
- Returns
- a KStarsDateTime object parsed from the given string.
- Note
- This function is format-agnostic; it will try several formats when parsing the string.
- Parameters
-
s the string expressing the date/time to be parsed.
Definition at line 91 of file kstarsdatetime.cpp.
◆ gst()
dms KStarsDateTime::gst | ( | ) | const |
- Returns
- The Greenwich Sidereal Time The Greenwich sidereal time is the Right Ascension coordinate that is currently transiting the Prime Meridian at the Royal Observatory in Greenwich, UK (longitude=0.0)
Definition at line 167 of file kstarsdatetime.cpp.
◆ GSTtoUT()
Convert a given Greenwich Sidereal Time to Universal Time (=Greenwich Mean Time).
GST
the Greenwich Sidereal Time to convert to Universal Time.
Definition at line 206 of file kstarsdatetime.cpp.
◆ jdToEpoch()
|
static |
Takes in a Julian Date and returns the corresponding epoch year in the given system.
- Returns
- the epoch as a floating-point year value
- Parameters
-
jd Julian date type Epoch system (KStarsDateTime::JULIAN or KStarsDateTime::BESSELIAN)
Definition at line 269 of file kstarsdatetime.cpp.
◆ operator!=()
|
inline |
Definition at line 121 of file kstarsdatetime.h.
◆ operator<()
|
inline |
Definition at line 125 of file kstarsdatetime.h.
◆ operator<=()
|
inline |
Definition at line 129 of file kstarsdatetime.h.
◆ operator=()
|
noexcept |
Definition at line 27 of file kstarsdatetime.cpp.
◆ operator==()
|
inline |
Definition at line 117 of file kstarsdatetime.h.
◆ operator>()
|
inline |
Definition at line 133 of file kstarsdatetime.h.
◆ operator>=()
|
inline |
Definition at line 137 of file kstarsdatetime.h.
◆ setDate()
Assign the Date according to a QDate object.
d
the QDate to assign
Definition at line 144 of file kstarsdatetime.cpp.
◆ setDJD()
void KStarsDateTime::setDJD | ( | long double | jd | ) |
Assign the static_cast<long double> Julian Day value, which includes the time of day encoded in the fractional portion.
jd
the Julian Day value to assign.
Definition at line 118 of file kstarsdatetime.cpp.
◆ setFromEpoch() [1/3]
Set the Date/Time from an epoch value, represented as a string.
e
the epoch value
- Returns
- true if date set successfully
- See also
- epoch()
Definition at line 245 of file kstarsdatetime.cpp.
◆ setFromEpoch() [2/3]
void KStarsDateTime::setFromEpoch | ( | double | e | ) |
Set the Date/Time from an epoch value, represented as a double.
e
the epoch value
- Note
- This method assumes that the epoch 1950.0 is Besselian, otherwise assumes that the epoch is a Julian epoch. This is provided for backward compatibility, and because custom catalogs may still use 1950.0 to mean B1950.0 despite the IAU standard for epochs being Julian.
- See also
- epoch()
Definition at line 228 of file kstarsdatetime.cpp.
◆ setFromEpoch() [3/3]
bool KStarsDateTime::setFromEpoch | ( | double | e, |
EpochType | type ) |
Set the Date/Time from an epoch value, represented as a double.
e
the epoch value
- See also
- epoch()
Definition at line 236 of file kstarsdatetime.cpp.
◆ setTime()
Assign the Time according to a QTime object.
t
the QTime to assign
- Note
- timespec is NOT changed even if the passed QTime has a different timespec than current.
Definition at line 161 of file kstarsdatetime.cpp.
◆ stringToEpoch()
Takes in a string and returns a Julian epoch.
Definition at line 288 of file kstarsdatetime.cpp.
Member Data Documentation
◆ B1900
The following values were obtained from Eric Weisstein's world of science: http://scienceworld.wolfram.com/astronomy/BesselianEpoch.html.
Definition at line 250 of file kstarsdatetime.h.
◆ JD_PER_BYEAR
Definition at line 251 of file kstarsdatetime.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 14 2024 11:55:04 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.