Home
Install
Use
Develop
Support
News
Credits
hosted by
|
11#ifndef __GENUTIL_MJD_H
12#define __GENUTIL_MJD_H
30 void add_day ( double dd);
34 static const MJD zero;
36 static double precision;
37 static unsigned ostream_precision;
42 MJD () { days=0;secs=0;fracsec=0.0; };
46 MJD ( int intday, double fracday);
47 MJD ( double dd, double ss, double fs);
48 MJD ( int dd, int ss, double fs);
51 MJD ( const char* mjdstring);
55 MJD ( const struct tm& greg);
56 MJD ( const struct timeval& tp);
59 MJD ( const utc_t& utc);
62 MJD ( const std::string& mjd);
83 double in_seconds() const;
84 double in_days() const;
85 double in_minutes() const;
88 int UTC (utc_t* utc, double* fsec=NULL) const;
89 int gregorian ( struct tm* gregdate, double* fsec=NULL) const;
91 MJD & operator = ( const MJD &);
92 MJD & operator += ( const MJD &);
93 MJD & operator -= ( const MJD &);
94 MJD & operator += ( const double &);
95 MJD & operator -= ( const double &);
96 MJD & operator *= ( const double &);
97 MJD & operator /= ( const double &);
98 friend const MJD operator + ( const MJD &, const MJD &);
99 friend const MJD operator - ( const MJD &, const MJD &);
100 friend const MJD operator + ( const MJD &, double);
101 friend const MJD operator - ( const MJD &, double);
102 friend const MJD operator * ( const MJD &, double);
103 friend const MJD operator * ( double a, const MJD& m) { return m * a; }
104 friend const MJD operator / ( const MJD &, double);
107 friend const MJD operator - ( MJD m);
109 friend int operator > ( const MJD &, const MJD &);
110 friend int operator < ( const MJD &, const MJD &);
111 friend int operator >= ( const MJD &, const MJD &);
112 friend int operator <= ( const MJD &, const MJD &);
113 friend int operator == ( const MJD &, const MJD &);
114 friend int operator != ( const MJD &, const MJD &);
117 float plotval() const { return float (in_days()); };
121 double fracday() const;
122 int get_secs() const { return(secs);};
123 double get_fracsec() const { return(fracsec);};
127 double LST ( double longitude) const;
130 double GMST () const;
132 std::string printdays ( unsigned precision) const;
134 int print (FILE *stream);
135 int println (FILE *stream);
136 std::string printall() const;
137 std::string printdays() const;
138 std::string printhhmmss() const;
139 std::string printfs() const;
140 std::string strtempo() const;
144 char* datestr ( char* dstr, int len, const char* format) const;
147 std::string datestr ( const char* format, unsigned fractional_second_digits = 0) const;
150 void from_datestr ( const std::string& datestr, const std::string& format = "%Y-%m-%d-%H:%M:%S");
153 friend bool equal ( const MJD &m1, const MJD &m2);
157inline double cast_double( const MJD&m) { return m.in_days();}
159std::ostream& operator<< (std::ostream& ostr, const MJD& mjd);
160std::istream& operator>> (std::istream& istr, MJD& mjd);
165 class numeric_limits<MJD> {
167 static const int digits10 = 15;
Class for representing modified Julian dates with high precision. Definition MJD.h:23
void from_datestr(const std::string &datestr, const std::string &format="%Y-%m-%d-%H:%M:%S") Parse MJD from the given datestr using strptime and the specified format. Definition MJD.C:672
double GMST() const return Greenwich Mean Sidereal Time in radians Definition sla_MJD.C:16
int Construct(const char *mjdstr) construct from a string of the form 51298.45034 ish Definition MJD.C:653
MJD() null constructor Definition MJD.h:42
double LST(double longitude) const return Local Sidereal Time in hours Definition sla_MJD.C:27
float plotval() const return plotable value to xyplot template class Definition MJD.h:117
char * datestr(char *dstr, int len, const char *format) const return a string formatted by strftime Definition MJD.C:152
Generated using doxygen 1.14.0
|