QP  0.7-SNAPSHOT
Control software for the ??SRT telescope
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
astrotime.h
1 #ifndef ASTROTIME_H_LOADED
2 #define ASTROTIME_H_LOADED 1
3 
4 #include <stdlib.h>
5 
6 #if PROVARINO
7 #include <string>
8 #endif
9 
10 // Ratio of sidereal time to UT, as of 2020 (0.2 Julian century from 2000)
11 // thus 1.002737909350795 + 5.9006e-11 * 0.2
12 #define STperUT 1.0027379093625963247
13 
17 class AstroTime {
18  private:
19  double ut24; // UT, as a number of hours
20  double obslong; // east-longitude of observatory, in radians
21  int mjd_ut0; // MJD of 0h UT1 on specified date
22 
23  mutable double gmst; // Greenwich Mean Sidereal Time of date, in radians
24 
25  public:
26  const double gmst_2pi(void) const;
27  const double lmst(void) const;
28  const double ut1(void) const;
29  const int mjd(void) const;
30 
31 #if PROVARINO
32  std::string ut1_str(void) const;
33  std::string ymd_str(void) const;
34  std::string str(void) const;
35 #endif
36 
37  AstroTime();
38  AstroTime(const int year,
39  const int month,
40  const int day,
41  const int hour,
42  const int minute,
43  const double second,
44  const double obslong);
45  // FIXME: This would be tidier, perhaps, as method
46  // delayed(extra_secs) (or later(), or inc_time()), by symmetry
47  // with move(obs_lon)
48  AstroTime(const AstroTime& ref, const double extra_secs);
49  AstroTime(const int year,
50  const int month,
51  const int day);
52  //AstroTime(const struct tm*, const double obslong);
53 
54  AstroTime move(double obs_lon);
55 
56  char* str(char*, size_t);
57 };
58 
59 #if PROVARINO
60 std::ostream& operator<<(std::ostream &strm, const AstroTime& a);
61 #endif
62 
63 #endif /* ASTROTIME_H_LOADED */
Encapsulates a few time properties which are astronomically relevant.
Definition: astrotime.h:17
AstroTime move(double obs_lon)
Return a new AstroTime representing the same UT as this one, but for a different observatory longitud...
Definition: astrotime.cpp:154
const int mjd(void) const
Return the MJD at time 00:00 on the indicated day.
Definition: astrotime.cpp:201
const double gmst_2pi(void) const
The following calculates GMST of date, in radians.
Definition: astrotime.cpp:277
const double lmst(void) const
Returns the Local Mean Sidereal Time at the observatory.
Definition: astrotime.cpp:248
char * str(char *, size_t)
Format the current time into the given buffer.
Definition: astrotime.cpp:368
const double ut1(void) const
Return UT1 as a number of hours.
Definition: astrotime.cpp:265
AstroTime()
The default constructor produces a valid, but largely useless structure, representing midnight on 185...
Definition: astrotime.cpp:29