ocssw
V2022
|
Classes | |
struct | TimGdtStruct |
struct | LeapStruct |
struct | TimError |
struct | ltGDT |
struct | ltLeap |
struct | lsCDS |
class | VcstTime |
union | VcstTime::TokenStruct::tokenVal |
class | TimException |
union | TimCDS |
Macros | |
#define | MAX_LEAP 156 |
#define | MAXBUFFER 256 |
#define | TIMERR_ROOT -1600 |
#define | TIMERR_BADDAY TIMERR_ROOT - 3 |
#define | TIMERR_BADHOUR TIMERR_ROOT - 4 |
#define | TIMERR_BADMIN TIMERR_ROOT - 5 |
#define | TIMERR_BADMONTH TIMERR_ROOT - 6 |
#define | TIMERR_BADMSEC TIMERR_ROOT - 7 |
#define | TIMERR_BADSEC TIMERR_ROOT - 8 |
#define | TIMERR_BADYEAR TIMERR_ROOT - 9 |
#define | TIMERR_LEAPACCESS TIMERR_ROOT - 10 |
#define | TIMERR_LEAPBADYEAR TIMERR_ROOT - 11 |
#define | TIMERR_LEAPBADMONTH TIMERR_ROOT - 12 |
#define | TIMERR_LEAPBADDAY TIMERR_ROOT - 13 |
#define | TIMERR_LEAPBADLEAP TIMERR_ROOT - 14 |
#define | TIMERR_LEAPOPEN TIMERR_ROOT - 15 |
#define | TIMERR_MONTHCALC TIMERR_ROOT - 16 |
#define | TIMERR_BADUTC TIMERR_ROOT - 17 |
#define | TIMERR_UTCCOLON2 TIMERR_ROOT - 18 |
#define | TIMERR_UTCDASH1 TIMERR_ROOT - 19 |
#define | TIMERR_UTCDOT1 TIMERR_ROOT - 20 |
#define | TIMERR_UTCMONTH TIMERR_ROOT - 21 |
#define | TIMERR_UTCT TIMERR_ROOT - 22 |
#define | TIMERR_NOINIT TIMERR_ROOT - 23 |
#define | TIMERR_BADTAI TIMERR_ROOT - 24 |
Typedefs | |
typedef std::set< const TimGdtStruct *, ltGDT > | GDTSet |
typedef std::set< unsigned long long, lsCDS > | CDSSet |
Functions | |
bool | operator() (const TimGdtStruct *gdt1, const TimGdtStruct *gdt2) const |
bool | operator() (const LeapStruct *leap1, const LeapStruct *leap2) const |
bool | operator() (const long long l1, const long long l2) const |
static VcstTime * | getInstance (void) |
int | initialize (void) |
int | initialize (const char *inLeapFile) |
double | taiNow (void) |
void | tai2Unix (double inTai, timespec *) |
double | unix2Tai (timespec *tspec) |
int | taiAddDelta (double *ioTai, double inDelta) |
int | taiSubtractDelta (double *ioTai, double inDelta) |
int | cds2Tai (unsigned long long inCds, double *outTai) |
int | tai2Cds (double inTai, unsigned long long *outCds) |
int | dispCds (unsigned long long inCds) |
int | tai2Gdt (double inTai, TimGdtStruct *outGdt) |
int | gdt2Tai (TimGdtStruct *inGdt, double *outTai) |
int | tai2String (double inTai, char *outString, int inFormat=1) |
int | string2Tai (std::string inString, double *outTai) |
void | printInfo () |
timespec | getSystemTime () |
static std::string | errorMessage (int errNo=1) |
TimException (void) | |
TimException (const std::string &errorString, int errorCode) | |
~TimException (void) throw () | |
int | getErrorCode () const |
std::string | getErrorString () const |
unsigned short | getDays () |
unsigned int | getMillis () |
unsigned short | getMicros () |
void | setDays (unsigned short) |
void | setMillis (unsigned int) |
void | setMicros (unsigned short) |
static int | makeCds (unsigned int inDay, unsigned long long inMsec, unsigned long long *outCds) |
static int | parseCds (unsigned long long inCds, unsigned int *outDay, unsigned long long *outMsec) |
static int | displayCds (unsigned long long inCds) |
Detailed Description
Macro Definition Documentation
◆ MAX_LEAP
#define MAX_LEAP 156 |
Definition at line 26 of file VcstTime.h.
◆ MAXBUFFER
#define MAXBUFFER 256 |
Definition at line 27 of file VcstTime.h.
◆ TIMERR_BADDAY
#define TIMERR_BADDAY TIMERR_ROOT - 3 |
Definition at line 34 of file VcstTime.h.
◆ TIMERR_BADHOUR
#define TIMERR_BADHOUR TIMERR_ROOT - 4 |
Definition at line 35 of file VcstTime.h.
◆ TIMERR_BADMIN
#define TIMERR_BADMIN TIMERR_ROOT - 5 |
Definition at line 36 of file VcstTime.h.
◆ TIMERR_BADMONTH
#define TIMERR_BADMONTH TIMERR_ROOT - 6 |
Definition at line 37 of file VcstTime.h.
◆ TIMERR_BADMSEC
#define TIMERR_BADMSEC TIMERR_ROOT - 7 |
Definition at line 38 of file VcstTime.h.
◆ TIMERR_BADSEC
#define TIMERR_BADSEC TIMERR_ROOT - 8 |
Definition at line 39 of file VcstTime.h.
◆ TIMERR_BADTAI
#define TIMERR_BADTAI TIMERR_ROOT - 24 |
Definition at line 55 of file VcstTime.h.
◆ TIMERR_BADUTC
#define TIMERR_BADUTC TIMERR_ROOT - 17 |
Definition at line 48 of file VcstTime.h.
◆ TIMERR_BADYEAR
#define TIMERR_BADYEAR TIMERR_ROOT - 9 |
Definition at line 40 of file VcstTime.h.
◆ TIMERR_LEAPACCESS
#define TIMERR_LEAPACCESS TIMERR_ROOT - 10 |
Definition at line 41 of file VcstTime.h.
◆ TIMERR_LEAPBADDAY
#define TIMERR_LEAPBADDAY TIMERR_ROOT - 13 |
Definition at line 44 of file VcstTime.h.
◆ TIMERR_LEAPBADLEAP
#define TIMERR_LEAPBADLEAP TIMERR_ROOT - 14 |
Definition at line 45 of file VcstTime.h.
◆ TIMERR_LEAPBADMONTH
#define TIMERR_LEAPBADMONTH TIMERR_ROOT - 12 |
Definition at line 43 of file VcstTime.h.
◆ TIMERR_LEAPBADYEAR
#define TIMERR_LEAPBADYEAR TIMERR_ROOT - 11 |
Definition at line 42 of file VcstTime.h.
◆ TIMERR_LEAPOPEN
#define TIMERR_LEAPOPEN TIMERR_ROOT - 15 |
Definition at line 46 of file VcstTime.h.
◆ TIMERR_MONTHCALC
#define TIMERR_MONTHCALC TIMERR_ROOT - 16 |
Definition at line 47 of file VcstTime.h.
◆ TIMERR_NOINIT
#define TIMERR_NOINIT TIMERR_ROOT - 23 |
Definition at line 54 of file VcstTime.h.
◆ TIMERR_ROOT
#define TIMERR_ROOT -1600 |
Definition at line 32 of file VcstTime.h.
◆ TIMERR_UTCCOLON2
#define TIMERR_UTCCOLON2 TIMERR_ROOT - 18 |
Definition at line 49 of file VcstTime.h.
◆ TIMERR_UTCDASH1
#define TIMERR_UTCDASH1 TIMERR_ROOT - 19 |
Definition at line 50 of file VcstTime.h.
◆ TIMERR_UTCDOT1
#define TIMERR_UTCDOT1 TIMERR_ROOT - 20 |
Definition at line 51 of file VcstTime.h.
◆ TIMERR_UTCMONTH
#define TIMERR_UTCMONTH TIMERR_ROOT - 21 |
Definition at line 52 of file VcstTime.h.
◆ TIMERR_UTCT
#define TIMERR_UTCT TIMERR_ROOT - 22 |
Definition at line 53 of file VcstTime.h.
Typedef Documentation
◆ CDSSet
Definition at line 187 of file VcstTime.h.
◆ GDTSet
typedef std::set<const TimGdtStruct*, ltGDT> GDTSet |
Definition at line 186 of file VcstTime.h.
Function Documentation
◆ cds2Tai()
int cds2Tai | ( | unsigned long long | inCds, |
double * | outTai | ||
) |
This method contains the algorithm to convert the date/time in CCSDS Day Segmentation (CDS) format to International Atomic Time (TAI) format.
- Parameters
-
inCds Time in CDS format for conversion outTai Place to put time in TAI Format
- Returns
- Status. 0 if OK, error code if not.
- Exceptions
-
TimException time exception, if error.
◆ dispCds()
int dispCds | ( | unsigned long long | inCds | ) |
This method Displays a CDS structure
- Parameters
-
inCds Place to put time in CDS format.
- Returns
- Status. 0 if OK, error code if not.
◆ displayCds()
|
static |
Display the internals of the byte buffer known as CDS.
- Parameters
-
inCds - byte buffer for display.
- Returns
- Status. 0 if OK, error code if not.
◆ errorMessage()
|
static |
Return a string describing the error
- Parameters
-
errNo error number for search
- Returns
- string describing error.
◆ gdt2Tai()
int gdt2Tai | ( | TimGdtStruct * | inGdt, |
double * | outTai | ||
) |
This method contains the algorithm to convert Gregorian Date Time (GDT) to International Atomic Time (TAI).
- Parameters
-
inGdt time in GDT format for conversion outTai place to put TAI format time.
- Returns
- Status. 0 if OK, error code if not.
- Exceptions
-
TimException time exception, if error.
◆ getDays()
unsigned short getDays | ( | ) |
◆ getErrorCode()
|
inline |
Definition at line 936 of file VcstTime.h.
◆ getErrorString()
|
inline |
Definition at line 940 of file VcstTime.h.
◆ getInstance()
|
static |
This method instantiates a singleton object. If it is called multiple times, it will return the same object pointer.
- Returns
- Singleton instance of VcstTime.
◆ getMicros()
unsigned short getMicros | ( | ) |
◆ getMillis()
unsigned int getMillis | ( | ) |
◆ getSystemTime()
timespec getSystemTime | ( | ) |
Return the system time in the INF standard format
- Returns
- system time in the UNIX standard format
◆ initialize() [1/2]
int initialize | ( | const char * | inLeapFile | ) |
This method contains the steps necessary to initialize and set up for use the time conversions. NOTE: This method is intended to be called once within a process space and should not be called multiple time within a multi-threaded environment.
- Parameters
-
inLeapFile path name for leap second file.
- Returns
- Status. 0 if OK, error code if not.
- Exceptions
-
TimException time exception, if error.
◆ initialize() [2/2]
int initialize | ( | void | ) |
This method finds the Naval Observatory leap second file to initialize the time utility. NOTE: This method is intended to be called once within a process space and should not be called multiple time within a multi-threaded environment.
- Returns
- Status. 0 if OK, error code if not.
- Exceptions
-
TimException time exception, if error.
◆ makeCds()
|
static |
Stuff day, millisecond and microsecond into a byte buffer
- Parameters
-
inDay Number of days since 1958 inMsec Number of Microseconds *outCds where to put cds format output
- Returns
- Status. 0 if OK, error code if not.
◆ operator()() [1/3]
|
inline |
Definition at line 155 of file VcstTime.h.
◆ operator()() [2/3]
Definition at line 181 of file VcstTime.h.
◆ operator()() [3/3]
|
inline |
Definition at line 107 of file VcstTime.h.
◆ parseCds()
|
static |
Parse day and microseconds out of byte buffer known as CDS.
- Parameters
-
inCds byte buffer for display. outDay Number of days since 1958 outMsec Number of Microseconds
- Returns
- Status. 0 if OK, error code if not.
◆ printInfo()
void printInfo | ( | ) |
Calling this method prints the current TAI and GDT time to standard out.
◆ setDays()
void setDays | ( | unsigned short | ) |
◆ setMicros()
void setMicros | ( | unsigned short | ) |
◆ setMillis()
void setMillis | ( | unsigned int | ) |
◆ string2Tai()
int string2Tai | ( | std::string | inString, |
double * | outTai | ||
) |
This method contains algorithms to convert Coordinated Universal Time (UTC) formatted time to International Atomic Time (TAI) formatted time.
- Parameters
-
inString Time in UTC format for conversion outTai Time converted to TAI format.
- Returns
- Status. 0 if OK, error code if not.
- Exceptions
-
TimException time exception, if error.
◆ tai2Cds()
int tai2Cds | ( | double | inTai, |
unsigned long long * | outCds | ||
) |
This method contains the algorithm to convert the International Atomic Time (TAI) format to date/time in CCSDS Day Segmentation (CDS) format.
- Parameters
-
inTai Time in TAI format for conversion. outCds Place to put time in CDS format.
- Returns
- Status. 0 if OK, error code if not.
- Exceptions
-
TimException time exception, if error.
◆ tai2Gdt()
int tai2Gdt | ( | double | inTai, |
TimGdtStruct * | outGdt | ||
) |
This method contains the algorithm to convert the date/time in International Atomic Time (TAI) format to Gregorian Date Time (GDT) format.
- Parameters
-
inTai Time in TAI format for conversion outGdt place to put GDT version.
- Returns
- Status. 0 if OK, error code if not.
- Exceptions
-
TimException time exception, if error.
◆ tai2String()
int tai2String | ( | double | inTai, |
char * | outString, | ||
int | inFormat = 1 |
||
) |
This method contains algorithm to convert International Atomic Time (TAI) formatted time to Universal Time Coordinated (UTC) formatted time.
- Parameters
-
inTai Time in TAI format for conversion outString Place to put UTC String output. inFormat format of UTC string: format1: With Dashes, with Microseconds format2: With Dashes, NO Microseconds format3: NO Dashes, with Microseconds format4: NO Dashes, NO Microseconds
- Returns
- Status. 0 if OK, error code if not.
- Exceptions
-
TimException time exception, if error.
◆ tai2Unix()
void tai2Unix | ( | double | inTai, |
timespec * | |||
) |
Converts Time (TAI) format time into Unix SystemTime
- Parameters
-
Current time in TAI format.
- Returns
- tspec pointer to timespec structure for return
◆ taiAddDelta()
int taiAddDelta | ( | double * | ioTai, |
double | inDelta | ||
) |
Add microseconds to TAI format, maintain leap seconds.
- Parameters
-
ioIet TAI format time to be added to inDelta Number of Microseconds being added
- Returns
- Current time in TAI format.
◆ taiNow()
double taiNow | ( | void | ) |
Requests the system time in International Atomic Time (TAI) format.
- Returns
- Current time in TAI format.
- Exceptions
-
TimException time exception, if error.
◆ taiSubtractDelta()
int taiSubtractDelta | ( | double * | ioTai, |
double | inDelta | ||
) |
Subtract microseconds to TAI format, maintain leap seconds.
- Parameters
-
ioIet TAI format time to be added to inDelta Number of Microseconds being subtracted.
- Returns
- Current time in TAI format.
◆ TimException() [1/2]
TimException | ( | const std::string & | errorString, |
int | errorCode | ||
) |
String and code Constructor. This is the main one used by Inf_Exception.
- Parameters
-
errorString error string for this exception errorCode error code for this exception
◆ TimException() [2/2]
TimException | ( | void | ) |
Default Constructor.
◆ unix2Tai()
double unix2Tai | ( | timespec * | tspec | ) |
Requests the system time in International Atomic Time (TAI) format.
- Parameters
-
tspec pointer to timespec structure for return
- Returns
- Current time in TAI format.
◆ ~TimException()
|
inline |
Destructor
Definition at line 928 of file VcstTime.h.
Variable Documentation
◆ d
double d |
Definition at line 418 of file VcstTime.h.
◆ day [1/2]
int day |
Definition at line 65 of file VcstTime.h.
◆ day [2/2]
int day |
Definition at line 87 of file VcstTime.h.
◆ ERR_BADDAY
|
static |
Error code for Invalid Day
Definition at line 784 of file VcstTime.h.
◆ ERR_BADDAY_MSG
const std::string ERR_BADDAY_MSG |
Error message for Invalid Day
◆ ERR_BADHOUR
|
static |
Error code for Invalid Hour
Definition at line 789 of file VcstTime.h.
◆ ERR_BADHOUR_MSG
const std::string ERR_BADHOUR_MSG |
Error message for Invalid Hour
◆ ERR_BADMIN
|
static |
Error code for Invalid Minute
Definition at line 794 of file VcstTime.h.
◆ ERR_BADMIN_MSG
const std::string ERR_BADMIN_MSG |
Error message for Invalid Minute
◆ ERR_BADMONTH
|
static |
Error code for Invalid Month
Definition at line 799 of file VcstTime.h.
◆ ERR_BADMONTH_MSG
const std::string ERR_BADMONTH_MSG |
Error message for Invalid Month
◆ ERR_BADMSEC
|
static |
Error code for Invalid Microsecond
Definition at line 804 of file VcstTime.h.
◆ ERR_BADMSEC_MSG
const std::string ERR_BADMSEC_MSG |
Error message for Invalid Microsecond
◆ ERR_BADSEC
|
static |
Error code for Invalid Second
Definition at line 809 of file VcstTime.h.
◆ ERR_BADSEC_MSG
const std::string ERR_BADSEC_MSG |
Error message for Invalid Second
◆ ERR_BADTAI
|
static |
Error code for negative TAI input
Definition at line 894 of file VcstTime.h.
◆ ERR_BADTAI_MSG
const std::string ERR_BADTAI_MSG |
Error message for negative TAI input
◆ ERR_BADUTC
|
static |
Error code for Invalid UTC string
Definition at line 859 of file VcstTime.h.
◆ ERR_BADUTC_MSG
const std::string ERR_BADUTC_MSG |
Error message for Invalid UTC string
◆ ERR_BADYEAR
|
static |
Error code for Invalid Year
Definition at line 814 of file VcstTime.h.
◆ ERR_BADYEAR_MSG
const std::string ERR_BADYEAR_MSG |
Error message for Invalid Year
◆ ERR_LEAPACCESS
|
static |
Error code for Leap Second file access
Definition at line 819 of file VcstTime.h.
◆ ERR_LEAPACCESS_MSG
const std::string ERR_LEAPACCESS_MSG |
Error message for Leap Second file access
◆ ERR_LEAPBADDAY
|
static |
Error code for Leap Second file invalid month
Definition at line 839 of file VcstTime.h.
◆ ERR_LEAPBADDAY_MSG
const std::string ERR_LEAPBADDAY_MSG |
Error message for Leap Second file invalid day
◆ ERR_LEAPBADLEAP
|
static |
Error code for Leap Second file invalid year
Definition at line 844 of file VcstTime.h.
◆ ERR_LEAPBADLEAP_MSG
const std::string ERR_LEAPBADLEAP_MSG |
Error message for Leap Second file invalid leap second
◆ ERR_LEAPBADMONTH
|
static |
Error code for Leap Second file invalid leap second
Definition at line 834 of file VcstTime.h.
◆ ERR_LEAPBADMONTH_MSG
const std::string ERR_LEAPBADMONTH_MSG |
Error message for Leap Second file invalid month
◆ ERR_LEAPBADYEAR
|
static |
Error code for Leap Second file invalid day
Definition at line 829 of file VcstTime.h.
◆ ERR_LEAPBADYEAR_MSG
const std::string ERR_LEAPBADYEAR_MSG |
Error message for Leap Second file invalid year
◆ ERR_LEAPOPEN
|
static |
Error code for Leap Second file open failed
Definition at line 849 of file VcstTime.h.
◆ ERR_LEAPOPEN_MSG
const std::string ERR_LEAPOPEN_MSG |
Error message for Leap Second file open failed
◆ ERR_LEAPREAD
|
static |
Error code for Leap Second read failed
Definition at line 824 of file VcstTime.h.
◆ ERR_LEAPREAD_MSG
const std::string ERR_LEAPREAD_MSG |
Error message for Leap Second read failed
◆ ERR_MONTHCALC
|
static |
Error code for MONTH CALC LOOP FAILED
Definition at line 854 of file VcstTime.h.
◆ ERR_MONTHCALC_MSG
const std::string ERR_MONTHCALC_MSG |
Error message for MONTH CALC LOOP FAILED
◆ ERR_NOINIT
|
static |
Error code for Init must be called before this function
Definition at line 889 of file VcstTime.h.
◆ ERR_NOINIT_MSG
const std::string ERR_NOINIT_MSG |
Error message for Init must be called before this function
◆ ERR_UTCCOLON2
|
static |
Error code for Invalid Second Colon in UTC string
Definition at line 864 of file VcstTime.h.
◆ ERR_UTCCOLON2_MSG
const std::string ERR_UTCCOLON2_MSG |
Error message for Invalid Second Colon in UTC string
◆ ERR_UTCDASH1
|
static |
Error code for No First Dash in UTC string
Definition at line 869 of file VcstTime.h.
◆ ERR_UTCDASH1_MSG
const std::string ERR_UTCDASH1_MSG |
Error message for No First Dash in UTC string
◆ ERR_UTCDOT1
|
static |
Error code for Invalid microseconds dot in UTC string
Definition at line 874 of file VcstTime.h.
◆ ERR_UTCDOT1_MSG
const std::string ERR_UTCDOT1_MSG |
Error message for Invalid microseconds dot in UTC string
◆ ERR_UTCMONTH
|
static |
Error code for Invalid Month in UTC string
Definition at line 879 of file VcstTime.h.
◆ ERR_UTCMONTH_MSG
const std::string ERR_UTCMONTH_MSG |
Error message for Invalid Month in UTC string
◆ ERR_UTCT
|
static |
Error code for Invalid 'T' delimiter in UTC string
Definition at line 884 of file VcstTime.h.
◆ ERR_UTCT_MSG
const std::string ERR_UTCT_MSG |
Error message for Invalid 'T' delimiter in UTC string
◆ errmsg
char errmsg[MAXBUFFER] |
Definition at line 97 of file VcstTime.h.
◆ errNo
int errNo |
Definition at line 96 of file VcstTime.h.
◆ EXCEPTION_CODE
|
static |
Generic error code for this exception
Definition at line 774 of file VcstTime.h.
◆ EXCEPTION_STRING
const std::string EXCEPTION_STRING |
Generic error string for this exception
◆ f
float f |
Definition at line 416 of file VcstTime.h.
◆ hour
int hour |
Definition at line 66 of file VcstTime.h.
◆ i
int i |
Definition at line 415 of file VcstTime.h.
◆ IOEXCEPTION
|
static |
Error code for Input / output exception
Definition at line 905 of file VcstTime.h.
◆ IOEXCEPTION_Msg
const std::string IOEXCEPTION_Msg |
Error message for put / output exception
◆ l
long long l |
Definition at line 417 of file VcstTime.h.
◆ leap
int leap |
Definition at line 89 of file VcstTime.h.
◆ ll
unsigned long long ll |
Definition at line 969 of file VcstTime.h.
◆ MAX_TAI_VALUE_EXCEEDED
|
static |
Error code for an TAI value that is greater than the upper limit of supported values
Definition at line 900 of file VcstTime.h.
◆ MAX_TAI_VALUE_EXCEEDED_MSG
const std::string MAX_TAI_VALUE_EXCEEDED_MSG |
Error message for an TAI value that is greater than the upper limit of supported values
◆ mill
int mill |
Definition at line 69 of file VcstTime.h.
◆ min
int min |
Definition at line 67 of file VcstTime.h.
◆ month [1/2]
int month |
Definition at line 64 of file VcstTime.h.
◆ month [2/2]
int month |
Definition at line 86 of file VcstTime.h.
◆ msec
int msec |
Definition at line 70 of file VcstTime.h.
◆ NAME_NOT_FOUND
|
static |
Error code if no name was found.
Definition at line 779 of file VcstTime.h.
◆ numday
int numday |
Definition at line 72 of file VcstTime.h.
◆ s
char* s |
Definition at line 414 of file VcstTime.h.
◆ sec
int sec |
Definition at line 68 of file VcstTime.h.
◆ tai
double tai |
Definition at line 88 of file VcstTime.h.
◆ type
tokenType type |
Definition at line 411 of file VcstTime.h.
◆ uc
unsigned char uc[8] |
Definition at line 970 of file VcstTime.h.
◆ val
union VcstTime::TokenStruct::tokenVal val |
◆ wkday
int wkday |
Definition at line 71 of file VcstTime.h.
◆ year [1/2]
int year |
Definition at line 63 of file VcstTime.h.
◆ year [2/2]
int year |
Definition at line 85 of file VcstTime.h.