Class for representing modified Julian dates with high precision. More...

#include <MJD.h>

Public Member Functions

 MJD ()
 null constructor
 MJD (double dd)
 construct from standard C types
 MJD (int intday, double fracday)
 MJD (double dd, double ss, double fs)
 MJD (int dd, int ss, double fs)
 MJD (const char *mjdstring)
 construct from a C string of the form "50312.4569"
 MJD (time_t time)
 some standard C time formats
 MJD (const struct tm &greg)
 MJD (const struct timeval &tp)
 MJD (const utc_t &utc)
 simple little struct invented in S2 days
 MJD (const std::string &mjd)
 construct from a C++ string
int Construct (const char *mjdstr)
 construct from a string of the form 51298.45034 ish
int Construct (time_t time)
 construct from the unix time_t
int Construct (const struct tm &greg)
 construct from the unix struct tm
int Construct (const struct timeval &tp)
 construct from another UNIX time standard
int Construct (const utc_t &utc)
 constructs from the home-grown utc_t
int Construct (uint64_t bat)
 construct from a BAT (binary atomic time), ie MJD in microseconds
double in_seconds () const
double in_days () const
double in_minutes () const
int UTC (utc_t *utc, double *fsec=NULL) const
int gregorian (struct tm *gregdate, double *fsec=NULL) const
MJDoperator= (const MJD &)
MJDoperator+= (const MJD &)
MJDoperator-= (const MJD &)
MJDoperator+= (const double &)
MJDoperator-= (const double &)
MJDoperator*= (const double &)
MJDoperator/= (const double &)
float plotval () const
 return plotable value to xyplot template class
int intday () const
double fracday () const
int get_secs () const
double get_fracsec () const
double LST (double longitude) const
 return Local Sidereal Time in hours
double GMST () const
 return Greenwich Mean Sidereal Time in radians
std::string printdays (unsigned precision) const
int print (FILE *stream)
int println (FILE *stream)
std::string printall () const
std::string printdays () const
std::string printhhmmss () const
std::string printfs () const
std::string strtempo () const
char * datestr (char *dstr, int len, const char *format) const
 return a string formatted by strftime
std::string datestr (const char *format, unsigned fractional_second_digits=0) const
 Convenient interface to datestr, with optional fractional seconds.
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.

Static Public Attributes

static const MJD zero
static double precision = 2.0e-12
static unsigned ostream_precision = 15
static int verbose = 0

Friends

const MJD operator+ (const MJD &m1, const MJD &m2)
const MJD operator- (const MJD &m1, const MJD &m2)
const MJD operator+ (const MJD &m1, double sss)
const MJD operator- (const MJD &m1, double sss)
const MJD operator* (const MJD &m1, double d)
const MJD operator* (double a, const MJD &m)
const MJD operator/ (const MJD &m1, double divisor)
const MJD operator- (MJD m)
int operator> (const MJD &m1, const MJD &m2)
int operator< (const MJD &m1, const MJD &m2)
int operator>= (const MJD &m1, const MJD &m2)
int operator<= (const MJD &m1, const MJD &m2)
int operator== (const MJD &m1, const MJD &m2)
int operator!= (const MJD &m1, const MJD &m2)
bool equal (const MJD &m1, const MJD &m2)

Detailed Description

Class for representing modified Julian dates with high precision.

Member Function Documentation

◆ Construct()

int MJD::Construct ( uint64_t bat)

construct from a BAT (binary atomic time), ie MJD in microseconds

Parameters
battime stored in two 32 bit unsigned integers, as returned by the AT clock

◆ datestr()

char * MJD::datestr ( char * dstr,
int len,
const char * format ) const

return a string formatted by strftime

Parameters
formatas used by strftime; e.g. "%Y-%m-%d %H:%M:%S"

Referenced by datestr(), and from_datestr().

◆ LST()

double MJD::LST ( double longitude) const

return Local Sidereal Time in hours

Parameters
(longitudegiven in degrees East of Greenwich)

References GMST().


The documentation for this class was generated from the following files:

Generated using doxygen 1.14.0