mtime 1.2.2
|
Files | |
file | mtime_calendar.h |
Singleton Calendar connecting all supported calendar types. | |
file | mtime_date.h |
Date and some operations supported on Date. | |
file | mtime_datetime.h |
DateTime and some operations supported on DateTime. | |
file | mtime_eventHandling.h |
Definition of the basic event type and its methods. Definition of Even-Groups which contains a list of events. | |
file | mtime_julianDay.h |
Julian Day Calendar and some operations supported on julian dates. | |
file | mtime_time.h |
Time and some operations supported on Time. | |
file | mtime_timedelta.h |
TimeDelta and some operations supported on TimeDelta. | |
file | mtime_utilities.h |
Support for handling ISO 8601:2004 repeated time interval strings. | |
Data Structures | |
struct | _date |
struct _date containing usual date parameters. More... | |
struct | _datetime |
struct _datetime contains a struct _date and a struct _time element. More... | |
struct | _eventGroup |
struct _eventGroup defines an Event-group. Each event group has an associated list of events. Event group is a place holder to 'group' events based on some user defined charteristics. More... | |
struct | _event |
struct _event defines events. Events are set to be triggered at pre-specified intervals. More... | |
struct | _julianday |
Struct _julianday containing julian day parameters. More... | |
struct | _time |
struct _time containing usual time parameters. More... | |
struct | _timedelta |
Struct _timedelta containing timedelta and sign of year parameter. More... | |
struct | _divisionquotienttimespan |
Struct _divisionquotienttimespan is used for storing division of two time-delta results. More... | |
Enumerations | |
enum | compare_return_val { equal_to = 0 , greater_than = 1 , less_than = -1 , compare_error = -128 } |
enum | calendarType { CALENDAR_NOT_SET = 0 , PROLEPTIC_GREGORIAN = 1 , YEAR_OF_365_DAYS = 2 , YEAR_OF_360_DAYS = 3 } |
enum calendarType lists the calendarTypes supported. The values are used for selecting calendars. More... | |
Functions | |
void | initCalendar (calendarType ct) |
To initialize a new calendar. | |
void | freeCalendar (void) |
called to discard the selected calendar type. | |
calendarType | getCalendarType (void) |
To query the current calendar type. | |
char * | calendarToString (char *calendar) |
convert the calendar identifier into a human readable string. | |
struct _date * | newDate (const char *ds) |
Construct new Date using an ISO 8601 conforming string. | |
struct _date * | newRawDate (int64_t _year, int _month, int _day) |
Construct new Date using 'raw' numerical values. | |
struct _date * | constructAndCopyDate (struct _date *d) |
Copy the values and construct a new date. | |
void | deallocateDate (struct _date *d) |
Destructor of Date. Free the Date object. | |
struct _date * | replaceDate (struct _date *, struct _date *) |
COPY a Date object. | |
char * | dateToString (struct _date *, char *ds) |
Get Date as an extended string. | |
char * | dateToBasicString (struct _date *, char *ds) |
Get Date as a basic string. | |
char * | dateToPosixString (struct _date *d, char *toStr, char *fmtString) |
Get Date in 'struct tm' format and return as a string. | |
struct _datetime * | newDateTime (const char *datetime_string) |
Construct new DateTime using an ISO 8601 conforming string. | |
struct _datetime * | newRawDateTime (int64_t _year, int _month, int _day, int _hour, int _minute, int _second, int _ms) |
Construct new DateTime using 'raw' numerical values. | |
struct _datetime * | constructAndCopyDateTime (struct _datetime *dt) |
Copy the values and construct a new datetime. | |
void | deallocateDateTime (struct _datetime *dt) |
Destructor of DateTime. | |
compare_return_val | compareDatetime (struct _datetime *dt1, struct _datetime *dt2) |
Compare two datetimes and return (dt1 > dt2) OR (dt1 = dt2) OR (dt1 < dt2). | |
struct _datetime * | replaceDatetime (struct _datetime *dtsrc, struct _datetime *dtdest) |
COPY a DateTime object. | |
char * | datetimeToString (struct _datetime *dt, char *toStr) |
Get DateTime as a string. | |
char * | datetimeToBasicString (struct _datetime *dt, char *toStr) |
Get DateTime as a basic string. | |
char * | datetimeToPosixString (struct _datetime *dt, char *toStr, char *fmtString) |
Get DateTime in 'struct tm' format and return as a string. | |
int | getNoOfDaysInMonthDateTime (struct _datetime *dt) |
Get nod (number of Days) in the month of DateTime. | |
int | getNoOfDaysInYearDateTime (struct _datetime *dt) |
Get number of days in the Year of DateTime. | |
int | getDayOfYearFromDateTime (struct _datetime *currentdt) |
Get the 'day-of-year' value of a DateTime. | |
int64_t | getNoOfSecondsElapsedInMonthDateTime (struct _datetime *dt) |
Get number of seconds elapsed in the month of DateTime. | |
int | getNoOfSecondsElapsedInDayDateTime (struct _datetime *dt) |
Get number of seconds elapsed in the day of DateTime. | |
struct _julianday * | getJulianDayFromDateTime (struct _datetime *dt, struct _julianday *jd) |
Get the Julian Day from DateTime. | |
struct _datetime * | getDateTimeFromJulianDay (struct _julianday *jd, struct _datetime *dt) |
Get the DateTime from Julian Day. | |
compare_return_val | getDateTimeIsInRange (struct _datetime *dtRef, struct _datetime *dtStart, struct _datetime *dtEnd) |
struct _eventGroup * | newEventGroup (const char *_eventGroupName) |
Construct new event-Group using a string. | |
void | deallocateEventGroup (struct _eventGroup *eg) |
Destructor of EventGroup. | |
bool | addNewEventToEventGroup (struct _event *e, struct _eventGroup *eg) |
Add new event to an eventgroup. | |
bool | removeEventFromEventGroup (char *eventName, struct _eventGroup *eg) |
Remove event from eventgroup. CRITICAL: Also, deallocate the event. | |
int64_t | getEventGroupId (struct _eventGroup *eg) |
char * | getEventGroupName (struct _eventGroup *eg, char *gname) |
struct _event * | getEventGroupRootEvent (struct _eventGroup *eg) |
struct _event * | newEvent (const char *_eventName, const char *_eventReferenceDate, const char *_eventFirstDate, const char *_eventLastDate, const char *_eventInterval, const char *_eventOffset) |
Construct new event using strings. | |
struct _event * | newEventWithDataType (const char *_eventName, struct _datetime *_eventReferenceDate, struct _datetime *_eventFirstDate, struct _datetime *_eventLastDate, struct _timedelta *_eventInterval, struct _timedelta *_eventOffset) |
Construct new event using data-types. | |
void | deallocateEvent (struct _event *e) |
Destructor of Event. | |
struct _event * | constructAndCopyEvent (struct _event *e) |
bool | isCurrentEventActive (struct _event *e, struct _datetime *current_dt, struct _timedelta *plus_slack, struct _timedelta *minus_slack) |
Check if this event is active by comparing event's trigger time with current_dt. | |
bool | iseventNextInNextDay (struct _event *e) |
bool | iseventNextInNextMonth (struct _event *e) |
bool | iseventNextInNextYear (struct _event *e) |
char * | eventToString (struct _event *e, char *string) |
Get Event as a string. | |
struct _datetime * | getTriggerNextEventAtDateTime (struct _event *e, struct _datetime *dt_current, struct _datetime *dt_return) |
Get the Datetime when 'this' event will be triggered next. | |
struct _datetime * | getTriggeredPreviousEventAtDateTime (struct _event *e, struct _datetime *dt_return) |
Get the Datetime when 'this' event was triggered last. | |
struct _event * | getNextEventInGroup (struct _event *e) |
int64_t | getEventId (struct _event *e) |
char * | getEventName (struct _event *e, char *ename) |
struct _datetime * | getEventReferenceDateTime (struct _event *e) |
struct _datetime * | getEventFirstDateTime (struct _event *e) |
struct _datetime * | getEventLastDateTime (struct _event *e) |
struct _timedelta * | getEventInterval (struct _event *e) |
bool | getNextEventIsFirst (struct _event *e) |
bool | getEventisFirstInDay (struct _event *e) |
bool | getEventisFirstInMonth (struct _event *e) |
bool | getEventisFirstInYear (struct _event *e) |
bool | getEventisLastInDay (struct _event *e) |
bool | getEventisLastInMonth (struct _event *e) |
bool | getEventisLastInYear (struct _event *e) |
struct _julianday * | newJulianDay (int64_t _day, int64_t _ms) |
Construct new Julian-Date object. | |
void | deallocateJulianDay (struct _julianday *jd) |
Destructor of Julian-Date. | |
struct _juliandelta * | newJulianDelta (char _sign, int64_t _day, int64_t _ms) |
void | deallocateJulianDelta (struct _juliandelta *jd) |
struct _julianday * | addJulianDeltaToJulianDay (struct _julianday *jd1, struct _juliandelta *jd2, struct _julianday *jd) |
struct _julianday * | subtractJulianDeltaFromJulianDay (struct _julianday *jd1, struct _juliandelta *jd2, struct _julianday *jd) |
char * | juliandayToString (struct _julianday *jd, char *toStr) |
Get Julian as a string. | |
struct _time * | newTime (const char *time_string) |
Construct new Time using an ISO 8601 conforming string. | |
struct _time * | newRawTime (int _hour, int _minute, int _second, int _ms) |
Construct new Time using 'raw' numerical values. | |
struct _time * | constructAndCopyTime (struct _time *t) |
Copy the values and construct a new Time. | |
void | deallocateTime (struct _time *t) |
Destructor of Time. | |
struct _time * | replaceTime (struct _time *, struct _time *) |
COPY a time object. | |
char * | timeToString (struct _time *, char *) |
Get time as an extended string. | |
char * | timeToBasicString (struct _time *, char *) |
Get time as a basic string. | |
char * | timeToPosixString (struct _time *t, char *toStr, char *fmtString) |
Get Time in 'struct tm' format and return as a string. | |
struct _timedelta * | newTimeDelta (const char *timedelta_string) |
Construct new TimeDelta using an ISO 8601 conforming string. | |
struct _timedelta * | newRawTimeDelta (char _sign, int64_t _year, int _month, int _day, int _hour, int _minute, int _second, int _ms) |
Construct new TimeDelta using 'raw' numerical values. | |
struct _timedelta * | constructAndCopyTimeDelta (struct _timedelta *td) |
Copy the values and construct a new TimeDelta. | |
void | deallocateTimeDelta (struct _timedelta *td) |
Destructor of TimeDelta. | |
compare_return_val | compareTimeDelta (struct _timedelta *td1, struct _timedelta *td2) |
Compare two timedelta and return (td1 > td2) OR (td1 = td2) OR (td1 < td2). | |
struct _timedelta * | replaceTimeDelta (struct _timedelta *tdsrc, struct _timedelta *tddest) |
COPY a TimeDelta object. | |
struct _juliandelta * | timeDeltaToJulianDelta (struct _timedelta *td, struct _datetime *dt, struct _juliandelta *jd) |
struct _timedelta * | julianDeltaToTimeDelta (struct _juliandelta *jd, struct _datetime *dt, struct _timedelta *td_return) |
struct _divisionquotienttimespan * | divideTimeDeltaInSeconds (struct _timedelta *dividend, struct _timedelta *divisor, struct _divisionquotienttimespan *quo_ret) |
struct _divisionquotienttimespan * | divideTwoDatetimeDiffsInSeconds (struct _datetime *dt1_dividend, struct _datetime *dt2_dividend, struct _datetime *dt1_divisor, struct _datetime *dt2_divisor, int64_t *denominator_ret, struct _divisionquotienttimespan *quo_ret) |
division of two differences in datetimes. | |
struct _divisionquotienttimespan * | divideDatetimeDifferenceInSeconds (struct _datetime *dt1, struct _datetime *dt2, struct _timedelta *divisor, struct _divisionquotienttimespan *quo_ret) |
division by an interval given in of seconds. | |
struct _timedelta * | getTimeDeltaFromDate (struct _date *, struct _date *, struct _timedelta *) |
Get the TimeDelta between two Dates d1 and d2 as (d1-d2). | |
struct _timedelta * | getTimeDeltaFromDateTime (struct _datetime *dt1, struct _datetime *dt2, struct _timedelta *td_return) |
Get the TimeDelta between two DateTimes dt1 and dt2 as (dt1-dt2). | |
int64_t | getTotalMilliSecondsTimeDelta (struct _timedelta *td, struct _datetime *dt) |
Get total number of milliseconds in timedelta. | |
int64_t | getTotalSecondsTimeDelta (struct _timedelta *td, struct _datetime *dt) |
Get total number of seconds in timedelta. | |
char * | timedeltaToString (struct _timedelta *td, char *toString) |
Get TimeDelta as an extended string. | |
struct _date * | addTimeDeltaToDate (struct _date *dt, struct _timedelta *td, struct _date *dt_return) |
Add timedelta to Date. | |
struct _datetime * | addTimeDeltaToDateTime (struct _datetime *dt, struct _timedelta *td, struct _datetime *dt_return) |
Add timedelta to DateTime. | |
struct _timedelta * | moduloTimeDeltaFromDateTime (struct _datetime *start_dt, struct _timedelta *timestep, struct _datetime *current_dt, struct _timedelta *modulo_td) |
Get the timedelta between current_dt and start_dt plus next integral-multiple-of-timestep (timedelta). | |
struct _timedelta * | elementwiseScalarMultiplyTimeDelta (struct _timedelta *base_td, int64_t lambda, struct _timedelta *scaled_td) |
Return the element-wise product of a scalar and a timedelta. | |
struct _timedelta * | elementwiseAddTimeDeltatoTimeDelta (struct _timedelta *td1, struct _timedelta *td2, struct _timedelta *td_return) |
Return the element-wise sum of two timedeltas. | |
int64_t | moduloTimedelta (struct _timedelta *a, struct _timedelta *p, int64_t *quot) |
Returns the remainder of timedelta a modulo timedelta p. | |
char * | getPTStringFromMS (int64_t _ms, char *PTstr) |
Return a PT String corresponding to arbitrary number of milliseconds. | |
char * | getPTStringFromSeconds (int64_t _s, char *PTstr) |
Return a PT String corresponding to arbitrary number of seconds. | |
char * | getPTStringFromSecondsFloat (float _s, char *PTstr) |
Return a PT String corresponding to arbitrary number of seconds. | |
char * | getPTStringFromSecondsDouble (double _s, char *PTstr) |
Return a PT String corresponding to arbitrary number of seconds. | |
char * | getPTStringFromMinutes (int64_t _m, char *PTstr) |
Return a PT String corresponding to arbitrary number of minutes. | |
char * | getPTStringFromHours (int64_t _h, char *PTstr) |
Return a PT String corresponding to arbitrary number of Hours. | |
void | splitRepetitionString (const char *recurringTimeInterval, char *repetitor, char *start, char *end, char *duration) |
Split ISO 8601:2004 repeated time interval strings into base components. | |
int | getRepetitions (const char *repetitionString) |
Extract number of repetitions from repetition string part. | |
Variables | |
const int | NO_OF_SEC_IN_A_DAY |
const int | NO_OF_SEC_IN_A_HOUR |
const int | NO_OF_SEC_IN_A_MINUTE |
const int | NO_OF_MS_IN_A_DAY |
const int | NO_OF_MS_IN_HALF_DAY |
const int | NO_OF_MS_IN_A_HOUR |
const int | NO_OF_MS_IN_A_MINUTE |
const int | NO_OF_MS_IN_A_SECOND |
const char | initDummyTDString [] |
const char | initDummyDString [] |
const char | initDummyDTString [] |
const int | nofDaysAfterARGMonthsInLeapYear [13] |
const int | nofDaysAfterARGMonthsInNonLeapYear [13] |
const int | nofDaysInARGMonthInLeapYear [] |
const int | nofDaysInARGMonthIn365DayYear [] |
const int | nofDaysInARGMonthIn360DayYear [] |
const int | monthSpecificDeltaInMonthsLeapyear [12][13] |
const int | monthSpecificDeltaInMonths365 [12][13] |
const int | monthSpecificDeltaInMonths360 [12][13] |
struct _julianday *(* | date2julian )(struct _datetime *date, struct _julianday *julian) |
Function pointer connecting the Calendar to Julian routine. The pointed-to Function depends on the selected Calendar type. | |
struct _datetime *(* | julian2date )(struct _julianday *julian, struct _datetime *date) |
Function pointer connecting Julian to Calendar routine. The pointed to Function depends on the selected Calendar type. | |
This module documents the C language bindings
struct _date |
struct _date containing usual date parameters.
Data Fields | ||
---|---|---|
int | day | day of date. |
int | month | Month of date. |
int64_t | year | Year of date. Can be both positive and negative. |
struct _datetime |
struct _eventGroup |
struct _eventGroup defines an Event-group. Each event group has an associated list of events. Event group is a place holder to 'group' events based on some user defined charteristics.
Data Fields | ||
---|---|---|
int64_t | eventGroupId | Event Group's ID. |
char * | eventGroupName | Event Group's name. |
struct _event * | rootEvent | Pointer to a List of events in this group. |
struct _event |
struct _event defines events. Events are set to be triggered at pre-specified intervals.
Data Fields | ||
---|---|---|
struct _datetime * | eventFirstDateTime | Start datetime of the event. Can be NULL; Initialized to 0-01-01T00:00:00.000. |
int64_t | eventId | Auto generated. (For future use. Not in use yet). |
struct _timedelta * | eventInterval | TimeDelta between succesive triggers. MUST be specified. |
bool | eventisFirstInDay | Is the event being triggered (i.e event when triggerCurrentEvent is true) First-In-Day? |
bool | eventisFirstInMonth | Is the event being triggered (i.e event when triggerCurrentEvent is true) First-In-Month? |
bool | eventisFirstInYear | Is the event being triggered (i.e event when triggerCurrentEvent is true) First-In-Year? |
bool | eventisLastInDay | Is the event being triggered (i.e event when triggerCurrentEvent is true) Last-In-Day? |
bool | eventisLastInMonth | Is the event being triggered (i.e event when triggerCurrentEvent is true) Last-In-Month? |
bool | eventisLastInYear | Is the event being triggered (i.e event when triggerCurrentEvent is true) Last-In-Year? |
struct _datetime * | eventLastDateTime | Last datetime of the event. Can be NULL; stays a NULL pointer: Logically NULL. |
char * | eventName | Event's name. |
struct _timedelta * | eventOffset | Shift eventReferenceDateTime by 'eventOffset' . Can be NULL; stays a NULL pointer: Logically 0. |
struct _datetime * | eventReferenceDateTime | Anchor datetime. Can be NULL; Initialized to eventFirstDateTime. . |
struct _datetime * | eventsLastEvaluationDateTime | Last evaluation datetime to allow for multiple queries. |
bool | lastEventWasFinal | Was the previously triggered event final? |
bool | neverTriggerEvent | for cases an event is set by an interval of 0 |
struct _event * | nextEventInGroup | Pointer to the next event in a given Event Group. |
bool | nextEventIsFirst | Is the next scheduled event the first to be triggered? |
bool | triggerCurrentEvent | is this event active? |
struct _datetime * | triggeredPreviousEventDateTime | Last Trigger event happened at this DT. Initialized with "0-01-01T00:00:00.000". |
struct _datetime * | triggerNextEventDateTime | Trigger the event next at this DT. |
struct _julianday |
Struct _julianday containing julian day parameters.
Data Fields | ||
---|---|---|
int64_t | day | the actual Julian day. |
int64_t | ms | the milisecond on that particular day. |
struct _time |
struct _time containing usual time parameters.
Data Fields | ||
---|---|---|
int | hour | hour part of time. |
int | minute | minute part of time. |
int | ms | milli-second part of time. 0<=ms<=999. |
int | second | second part of time. |
struct _timedelta |
Struct _timedelta containing timedelta and sign of year parameter.
struct _divisionquotienttimespan |
Struct _divisionquotienttimespan is used for storing division of two time-delta results.
Data Fields | ||
---|---|---|
int64_t | quotient | Quotient of two timedeltas. |
int64_t | remainder_in_ms | Remainder in milli seconds of two timedeltas division. |
enum calendarType |
enum calendarType lists the calendarTypes supported. The values are used for selecting calendars.
bool addNewEventToEventGroup | ( | struct _event * | e, |
struct _eventGroup * | eg ) |
Add new event to an eventgroup.
e | A pointer to struct _event. The event to be added. |
eg | A pointer to struct _eventGroup. The eventGroup where the event is added. |
struct _date * addTimeDeltaToDate | ( | struct _date * | d, |
struct _timedelta * | td, | ||
struct _date * | d_return ) |
Add timedelta to Date.
Routine addTimeDeltaToDate adds a timedelta to a Date and returns the new Date. Both Date and TimeDetla are first converted to corresponding values on the Julian axis. Addition is performed on the julian axis and the resulting Julian Date is converted back to the corrsponding Date.
The library assumes the following definition: Let A denote an anchor date and P a timedelta. For a positive P, A + P = B where date B > A. Consequently, for a negative P, A + P = B where A > B. Also, when P is positive, a delta of 1 month has as many days as in the month of anchor DateTime; a delta of 2 months corresponds to the number of days in the anchor date month and the next month and so on. When P is negative, a delta of 1 month corresponds to as many days as in the month before the anchor date month; a delta of 2 month corresponds to as many days as in the month before the anchor date month and the month before that and so on.
d | A pointer to struct _date. The base date. |
td | A pointer to struct _timedelta. The time delta to be added to d. |
d_return | A pointer to struct _date. The result of addition is copied here. |
struct _datetime * addTimeDeltaToDateTime | ( | struct _datetime * | dt, |
struct _timedelta * | td, | ||
struct _datetime * | dt_return ) |
Add timedelta to DateTime.
Routine addTimeDeltaToDateTime adds a timedelta to a DateTime and returns the new DateTime. Both DateTime and TimeDetla are first converted to corresponding values on the Julian axis. Addition is performed on the julian axis and the resulting Julian Date is converted back to the corrsponding DateTime.
The library assumes the following definition: Let A denote an anchor date and P a timedelta. For a positive P, A + P = B where date B > A. Consequently, for a negative P, A + P = B where A > B. Also, when P is positive, a delta of 1 month has as many days as in the month of anchor DateTime; a delta of 2 months corresponds to the number of days in the anchor date month and the next month and so on. When P is negative, a delta of 1 month corresponds to as many days as in the month before the anchor date month; a delta of 2 month corresponds to as many days as in the month before the anchor date month and the month before that and so on.
dt | A pointer to struct _datetime. The base datetime. |
td | A pointer to struct _timedelta. The time delta to be added to dt. |
dt_return | A pointer to struct _datetime. The result of addition is copied here. |
char * calendarToString | ( | char * | calendar | ) |
convert the calendar identifier into a human readable string.
Gets a string describing the calendar in use.
calendar | A pointer to char. A string where the currently set calendar type will be written. |
Compare two datetimes and return (dt1 > dt2) OR (dt1 = dt2) OR (dt1 < dt2).
compare_return_val compareTimeDelta | ( | struct _timedelta * | td1, |
struct _timedelta * | td2 ) |
Compare two timedelta and return (td1 > td2) OR (td1 = td2) OR (td1 < td2).
td1 | A pointer to struct _timedelta. |
td2 | A pointer to struct _timedelta. |
Copy the values and construct a new date.
d | A pointer to struct _date. Values of d are used to initialize the new date object being created. |
Copy the values and construct a new datetime.
dt | A pointer to struct _datetime. Values of dt are used to initialize the new datetime being created. |
Copy the values and construct a new Time.
t | A pointer to struct _time. Values of t are used to initialize the new time being created. |
struct _timedelta * constructAndCopyTimeDelta | ( | struct _timedelta * | td | ) |
Copy the values and construct a new TimeDelta.
td | A pointer to struct _timedelta. Values of td are used to initialize the new timedelta being created. |
char * datetimeToBasicString | ( | struct _datetime * | dt, |
char * | toStr ) |
Get DateTime as a basic string.
datetimeToBasicString returns a string in IS08601 compliant format.
dt | A pointer to struct _datetime. The datetime to be converted to string. |
toStr | A pointer to char. String where datetime is to be written. |
char * datetimeToPosixString | ( | struct _datetime * | dt, |
char * | toStr, | ||
char * | fmtString ) |
Get DateTime in 'struct tm' format and return as a string.
Only dates between and including 1582-10-15 TO 9999-12-31 supported.
dt | A pointer to struct _datetime. The datetime to be converted to string. |
toStr | A pointer to char. String where datetime is to be written. |
fmtString | A pointer to char. Desired Format string. CRITICAL: Inappropriate fmt string will cause dump. |
char * datetimeToString | ( | struct _datetime * | dt, |
char * | toStr ) |
Get DateTime as a string.
datetimeToString returns a string in IS08601 compliant (and extended) format.
dt | A pointer to struct _datetime. The datetime to be converted to string. |
toStr | A pointer to char. String where datetime is to be written. |
char * dateToBasicString | ( | struct _date * | d, |
char * | toStr ) |
Get Date as a basic string.
DateToBasicString returns a string in IS08601 compliant format.
d | A pointer to struct _date. The date to be converted to string. |
toStr | A pointer to char. String where date is to be written. |
char * dateToPosixString | ( | struct _date * | d, |
char * | toStr, | ||
char * | fmtString ) |
Get Date in 'struct tm' format and return as a string.
Only dates between and including 1582-10-15 TO 9999-12-31 supported.
d | A pointer to struct _date. The date to be converted to string. |
toStr | A pointer to char. String where date is to be written. |
fmtString | A pointer to char. Desired Format string. CRITICAL: Inappropriate fmt string will cause dump. |
char * dateToString | ( | struct _date * | d, |
char * | toStr ) |
Get Date as an extended string.
DateToString returns a string in IS08601 compliant (and extended) format.
d | A pointer to struct _date. The date to be converted to string. |
toStr | A pointer to char. String where date is to be written. |
void deallocateDate | ( | struct _date * | d | ) |
Destructor of Date. Free the Date object.
d | A pointer to struct _date. d is deallocated. |
void deallocateDateTime | ( | struct _datetime * | dt | ) |
Destructor of DateTime.
dt | A pointer to struct _datetime. dt is deallocated. |
void deallocateEvent | ( | struct _event * | e | ) |
Destructor of Event.
e | A pointer to struct _event. e is deallocated. |
void deallocateEventGroup | ( | struct _eventGroup * | eg | ) |
Destructor of EventGroup.
eg | A pointer to struct _eventGroup. eg is deallocated. |
void deallocateJulianDay | ( | struct _julianday * | jd | ) |
Destructor of Julian-Date.
jd | A pointer to struct _julianday. jd is deallocated. |
void deallocateTime | ( | struct _time * | t | ) |
Destructor of Time.
t | A pointer to struct _time. t is deallocated. |
void deallocateTimeDelta | ( | struct _timedelta * | td | ) |
Destructor of TimeDelta.
td | A pointer to struct _timedelta. td is deallocated. |
struct _divisionquotienttimespan * divideDatetimeDifferenceInSeconds | ( | struct _datetime * | dt1, |
struct _datetime * | dt2, | ||
struct _timedelta * | divisor, | ||
struct _divisionquotienttimespan * | quo_ret ) |
struct _divisionquotienttimespan * divideTwoDatetimeDiffsInSeconds | ( | struct _datetime * | dt1_dividend, |
struct _datetime * | dt2_dividend, | ||
struct _datetime * | dt1_divisor, | ||
struct _datetime * | dt2_divisor, | ||
int64_t * | denominator_ret, | ||
struct _divisionquotienttimespan * | quo_ret ) |
division of two differences in datetimes.
dt1_dividend,dt2_dividend,dt1_divisor,dt2_divisor | Reference date (a pointer to struct _datetime). |
intvlsec | Interval given in seconds. |
struct _timedelta * elementwiseAddTimeDeltatoTimeDelta | ( | struct _timedelta * | td1, |
struct _timedelta * | td2, | ||
struct _timedelta * | td_return ) |
Return the element-wise sum of two timedeltas.
elementwiseAddTimeDeltatoTimeDelta adds two timedeltas elementwise and returns the result. Timedeltas being added must be of the same sign; Subtraction is not supported. The timedelta can not have days,months or years however: Only Timedeltas upto hours should call this routine. Also td_return->hour >= 24 will lead to an error.
td1 | A pointer to struct _timedelta. |
td2 | A pointer to struct _timedelta. |
td_return | A pointer to struct _timedelta. The element-wise sum of td1 and td2 is stored here. |
struct _timedelta * elementwiseScalarMultiplyTimeDelta | ( | struct _timedelta * | base_td, |
int64_t | lambda, | ||
struct _timedelta * | scaled_td ) |
Return the element-wise product of a scalar and a timedelta.
elementwiseScalarMultiplyTimeDelta multiplies scalar lambda with each element of timedelta and returns the result in scaled_td. Scalar can be both positive and negative and so can the timedelta. The timedelta can not have days,months or years however: Only Timedeltas upto hours should call this routine. Also scaled_td->hour >= 24 will lead to an error.
base_td | A pointer to struct _timedelta. The base timedelta. |
lambda | A scalar to be multiplied. |
scaled_td | A pointer to struct _timedelta. The element-wise product of lambda and base_td is stored here. |
char * eventToString | ( | struct _event * | e, |
char * | string ) |
Get Event as a string.
e | A pointer to struct _event. The event to be converted to string. |
string | A pointer to char. String where event is to be written. |
void freeCalendar | ( | void | ) |
called to discard the selected calendar type.
RESETs the calendar. Should be performed ONLY at exit! WARNING: Freeing the calendar and re-assigning a new calendar type not supported.
calendarType getCalendarType | ( | void | ) |
To query the current calendar type.
Gets the calendarType.
struct _datetime * getDateTimeFromJulianDay | ( | struct _julianday * | jd, |
struct _datetime * | dt ) |
Get the DateTime from Julian Day.
The routine getDateTimeFromJulianDay returns the equivalent DateTime to Julian date. Internally it calls translation routines based on Calendar type.
jd | A pointer to struct _julianday. The JD's value is converted to julian day value. |
dt | A pointer to struct _datetime. The DT where the converted value is stored. |
int getDayOfYearFromDateTime | ( | struct _datetime * | dt | ) |
Get the 'day-of-year' value of a DateTime.
Routine getDayOfYearFromDateTime returns Day of Year for the DateTime. This routine supports all Calendar types.
For eg. the day of year value for 2001-10-15T00:00:00.000 will be 288 for Gregorian Calendar. Similarly, this value will be 285 for Calendar of type 360 day-Calendar.
dt | A pointer to struct _datetime. Retrieve the 'day-of-year' from this DT object. |
struct _julianday * getJulianDayFromDateTime | ( | struct _datetime * | dt, |
struct _julianday * | jd ) |
Get the Julian Day from DateTime.
The routine getJulianDayFromDateTime returns the equivalent Julian date to DateTime. Internally it calls translation routines based on Calendar type.
dt | A pointer to struct _datetime. The DT's value is converted to julian day value. |
jd | A pointer to struct _julianday. JD where the converted value is stored. |
int getNoOfDaysInMonthDateTime | ( | struct _datetime * | dt | ) |
Get nod (number of Days) in the month of DateTime.
Routine getNoOfDaysInMonthDateTime returns number of days in the month of DateTime. This routine supports all calendar types.
For eg. the number of days for 2001-10-15T00:00:00.000 will be 31 for Gregorian Calendar. Similarly, this value will be 30 for Calendar of type 360 day-Calendar.
dt | A pointer to struct _datetime. |
int getNoOfDaysInYearDateTime | ( | struct _datetime * | dt | ) |
Get number of days in the Year of DateTime.
Routine getNoOfDaysInYearDateTime returns number of days in the Year of DateTime. This routine supports all calendar types.
Number of days returned will depend on the calendar type and if applicable, leap v/s non leap year.
dt | A pointer to struct _datetime. |
int getNoOfSecondsElapsedInDayDateTime | ( | struct _datetime * | dt | ) |
Get number of seconds elapsed in the day of DateTime.
dt | A pointer to struct _datetime. |
int64_t getNoOfSecondsElapsedInMonthDateTime | ( | struct _datetime * | dt | ) |
Get number of seconds elapsed in the month of DateTime.
dt | A pointer to struct _datetime. |
char * getPTStringFromHours | ( | int64_t | _h, |
char * | PTstr ) |
Return a PT String corresponding to arbitrary number of Hours.
getPTStringFromHours() translates hour values to ISO 8601 compliant timedelta string. Conversion of h >= 24 and ms <= -24 not supported.
_h | An int64_t value to be translated. |
PTstr | A pointer to char. Translated string is written here. |
char * getPTStringFromMinutes | ( | int64_t | _m, |
char * | PTstr ) |
Return a PT String corresponding to arbitrary number of minutes.
getPTStringFromMinutes() translates minutes values to ISO 8601 compliant timedelta string. Conversion of m >= 1440 and m <= -1440 not supported.
_m | An int64_t value to be translated. |
PTstr | A pointer to char. Translated string is written here. |
char * getPTStringFromMS | ( | int64_t | _ms, |
char * | PTstr ) |
Return a PT String corresponding to arbitrary number of milliseconds.
getPTStringFromMS() translates ms values to ISO 8601 compliant timedelta string. Conversion of ms >= 86400000 and ms <= -86400000 not supported.
_ms | An int64_t value to be translated. |
PTstr | A pointer to char. Translated string is written here. |
char * getPTStringFromSeconds | ( | int64_t | _s, |
char * | PTstr ) |
Return a PT String corresponding to arbitrary number of seconds.
getPTStringFromSeconds() translates second values to ISO 8601 compliant timedelta string. Conversion of s >= 86400 and s <= -86400 not supported.
_s | An int64_t value to be translated. |
PTstr | A pointer to char. Translated string is written here. |
char * getPTStringFromSecondsDouble | ( | double | _s, |
char * | PTstr ) |
Return a PT String corresponding to arbitrary number of seconds.
getPTStringFromSecondsDouble() translates second values to ISO 8601 compliant timedelta string. Conversion of s >= 86400 and s <= -86400 not supported. Returned PT string has a precision of 3 digits.
_s | Double value to be translated. |
PTstr | A pointer to char. Translated string is written here. |
char * getPTStringFromSecondsFloat | ( | float | _s, |
char * | PTstr ) |
Return a PT String corresponding to arbitrary number of seconds.
getPTStringFromSecondsFloat() translates second values to ISO 8601 compliant timedelta string. Conversion of s >= 86400 and s <= -86400 not supported. Returned PT string has a precision of 3 digits.
_s | Float value to be translated. |
PTstr | A pointer to char. Translated string is written here. |
int getRepetitions | ( | const char * | repetitionString | ) |
Extract number of repetitions from repetition string part.
[in] | repetitionString | A pointer to char. A repetition string starting with 'R'. A string literal can be accepted. |
struct _timedelta * getTimeDeltaFromDate | ( | struct _date * | d1, |
struct _date * | d2, | ||
struct _timedelta * | td_return ) |
Get the TimeDelta between two Dates d1 and d2 as (d1-d2).
Routine getTimeDeltaFromDate 'subtracts' two Dates and returns the TimeDelta between them. Internally, Dates are converted to DateTimes and then delta is calculated using getTimeDeltaFromDateTime().
This routine handles all supported Calendar types; i.e. the translation from Calendar date to Julian date and conversion from Julian Delta to normal TimeDetla is Calendar-type dependent. For eg. for Calendar type Gregorian, the TimeDelta between 2001-02-01 and 2001-01-01 will be 1 month. Similarly, for Calendar of type 360-Day-Calendar, the TimeDelta will be 1 month. It must be noted however, that the two dates differ by 31 and 30 days respectively.
d1 | A pointer to struct _date. |
d2 | A pointer to struct _date. |
td_return | A pointer to struct _timedelta. Copy the result of (d1 - d2) in td_return. |
struct _timedelta * getTimeDeltaFromDateTime | ( | struct _datetime * | dt1, |
struct _datetime * | dt2, | ||
struct _timedelta * | td_return ) |
Get the TimeDelta between two DateTimes dt1 and dt2 as (dt1-dt2).
Routine getTimeDeltaFromDateTime 'subtracts' two DateTime's and returns the TimeDelta between them. Each datetime is converted to an equivalent Julian Date. Subtraction is then performed on Julian axis. The "Julian delta" is finally converted back to normal calendar delta.
This routine handles all supported Calendar types; i.e. the translation from Calendar date to Julian date and conversion from Julian Delta to normal TimeDetla is Calendar-type dependent. For eg. for Calendar type Gregorian, the TimeDelta between 2001-02-01T00:00:00.000 and 2001-01-01T00:00:00.000 will be 1 month. Similarly, for Calendar of type 360-Day-Calendar, the TimeDelta will be 1 month. It must be noted however, that the two dates differ by 31 and 30 days respectively.
dt1 | A pointer to struct _datetime. |
dt2 | A pointer to struct _datetime. |
td_return | A pointer to struct _timedelta. Copy the result of (dt1 - dt2) in td_return. |
int64_t getTotalMilliSecondsTimeDelta | ( | struct _timedelta * | td, |
struct _datetime * | base_dt ) |
Get total number of milliseconds in timedelta.
Routine getTotalMilliSecondsTimeDelta returns the total number of milliseconds in TimeDelta. Notice that TimeDelta is not uniquely defined but depends on the definition of corresponding DateTime. TimeDelta is first converted to corresponding delta on the Julian axis. Julian delta is finally converted to the correct millisecond value.
td | A pointer to struct _timedelta. Retrieve the number of milliseconds in this TD object. |
base_dt | A pointer to struct _datetime. Reference Datetime for the TD. |
int64_t getTotalSecondsTimeDelta | ( | struct _timedelta * | td, |
struct _datetime * | base_dt ) |
Get total number of seconds in timedelta.
Routine getTotalSecondsTimeDelta returns the total number of seconds in TimeDelta. Notice that TimeDelta is not uniquely defined but depends on the definition of corresponding DateTime. Internally, number of seconds is calculated by calling the routine getTotalMilliSecondsTimeDelta() and then converting the millisecond value to seconds by dividing it by 1000.
td | A pointer to struct _timedelta. Retrieve the number of seconds in this TD object. |
base_dt | A pointer to struct _datetime. Reference Datetime for the TD. |
struct _datetime * getTriggerNextEventAtDateTime | ( | struct _event * | e, |
struct _datetime * | current_dt, | ||
struct _datetime * | dt_return ) |
Get the Datetime when 'this' event will be triggered next.
WARNING: The value returned is with-respect-to current_dt and not a true copy of triggerNextEventDateTime in the event data structure.
e | A pointer to struct _event. This is the event being queried. |
dt_return | A pointer to struct _datetime. The next trigger datetime is copied here. |
void initCalendar | ( | calendarType | ct | ) |
To initialize a new calendar.
Calendar init is done at the very begining to use this calendar lib. Init intializes the calendar to:
The calendar type and hence it's behaviour (Calendar to Julian conversion and vice versa) is fixed for the lifetime of the calendar object. Attempts to change the calendar type at runtime is discouraged. The lib has built-in checks to reject change attempts. Calendar can be "re-initialized" after calling freeCalendar() but is not advised. MANTRA: Know what you are doing before you do it and do it right the first time.
ct | An object of struct calendarType. ct 'fixes' the calendar type by setting function pointers to point to functions designed to work with that calendarType. |
bool isCurrentEventActive | ( | struct _event * | event, |
struct _datetime * | current_dt, | ||
struct _timedelta * | plus_slack, | ||
struct _timedelta * | minus_slack ) |
Check if this event is active by comparing event's trigger time with current_dt.
The current_dt must lie in event's trigger time (subject to optional specified slack: [Trigger_time - minus_slack, Trigger_time + plus_slack]. Slacks can be NULL. Always
inclusive.) The lib has no built-in clock but relies on isCurrentEventActive(.) being called (polled) from the application at fixed intervals.
event | A pointer to struct _event. This is the event being tested. |
current_dt | A pointer to struct _datetime. This is the 'current' datetime of the system. |
plus_slack | A pointer to struct _timedelta. Events are triggered between [actual_trigger_time, actual_trigger_time + plus_slack]. Can be NULL; logically 0. Sign MUST be '+' |
minus_slack | A pointer to struct _timedelta. Events are triggered between [actual_trigger_time - minus_slack, actual_trigger_time]. Can be NULL; logically 0. Sign MUST be '+' |
char * juliandayToString | ( | struct _julianday * | jd, |
char * | toStr ) |
Get Julian as a string.
juliandayToString returns a string in Day.MS format.
jd | A pointer to struct _julianday. The julian value to be converted to string. |
toStr | A pointer to char. String where julian value is to be written. |
int64_t moduloTimedelta | ( | struct _timedelta * | a, |
struct _timedelta * | p, | ||
int64_t * | quot ) |
Returns the remainder of timedelta a modulo timedelta p.
moduloTimedelta(struct _timedelta *a, struct _timdelta *p) returns the remainder of a modulo p. The function is restricted to input timedeltas less than 29 days.
a | a valid timedelta objact < P29D. |
p | a valid timedelta objact < P29D. |
p | on return contains the quotient |
struct _timedelta * moduloTimeDeltaFromDateTime | ( | struct _datetime * | start_dt, |
struct _timedelta * | timestep, | ||
struct _datetime * | current_dt, | ||
struct _timedelta * | modulo_td ) |
Get the timedelta between current_dt and start_dt plus next integral-multiple-of-timestep (timedelta).
Routine moduloTimeDeltaFromDateTime returns the timedelta between the current DateTime (current_dt) and the event's next-trigger time. The next trigger time is defined as the the Anchor DateTime (start_dt) + N * TimeDelta(timestep) where N is the minimum positive integer for which this sum is >= Current DateTime. In case Anchor DateTime > Current DateTime, TimeDelta is calculated as start_dt - current_dt.
Notice that this TimeDelta will always be positive.
start_dt | A pointer to struct _datetime. The base datetime. |
timestep | A pointer to struct _timedelta. delta between two consecutive triggers. |
current_dt | A pointer to struct _datetime. The Current Date time. |
modulo_td | A pointer to struct _timedelta. The timedelta between 'current datetime' and 'Start Datetime plus next integral-multiple-of-timestep' is copied here. |
struct _date * newDate | ( | const char * | ds | ) |
Construct new Date using an ISO 8601 conforming string.
MAX allowed year = 2147483647 and MIN allowed year = -2147483648. Strings of the following form are valid: <table> <tr><th>Extended Format: <th> <tr><td> +/-([Y]+)-MM-DD <td> [Y]+ stands for year and can be of any char length (>= 1) but must be in range: [MIN allowed year, MAX allowed year]. Sign can be +/- or emtpy with default + <tr><td> +/-([Y]+)-MM <td> </table> <table> <tr><th>Basic Format: <th> <tr><td> +/-YYYYMMDD <td> Note that Year is 4 char long. Sign can be +/- or empty with default + </table> In essence, strings follow the guidelines in ISO8601 standard (but do not support all formats).
ds | A pointer to char. The string should contain parameters with which Date object is to be created. A string literal can be accepted. |
struct _datetime * newDateTime | ( | const char * | dts | ) |
Construct new DateTime using an ISO 8601 conforming string.
MAX allowed year = 2147483647 and MIN allowed year = -2147483648. Strings of the following form are valid: <table> <tr><th> Extended Format: <th> <tr><td> +/-([Y]+)-MM-DDTHH:MM:SS.SSS <td> [Y]+ stands for year can be of any char length (>= 1) but must be in range: [MIN allowed year, MAX allowed year]. Sign can be +/- or empty with default +. Also, .SSS can be of length 1-3 <tr><td> +/-([Y]+)-MM-DDTHH:MM:SS <td> <tr><td> +/-([Y]+)-MM-DDTHH:MM <td> <tr><td> +/-([Y]+)-MM-DDTHH <td> <tr><td> +/-([Y]+)-MM-DD <td> <tr><td> +/-([Y]+)-MM <td> </table> <table> <tr><th> Basic Format: <th> <tr><td> +/-YYYYMMDDTHHMMSS.SSS <td> Note that Year is 4 char long. Sign can be +/- or empty with default +. Also, .SSS can be of length 1-3 <tr><td> +/-YYYYMMDDTHHMMSS <td> <tr><td> +/-YYYYMMDDTHHMM <td> <tr><td> +/-YYYYMMDDTHH <td> <tr><td> +/-YYYYMMDD <td> </table> In essence, strings follow the guidelines in ISO8601 standard (but do not support all formats).
dts | A pointer to char. The string should contain parameters with which DateTime is created. A string literal can be accepted. |
struct _event * newEvent | ( | const char * | _en, |
const char * | _eventReferenceDT, | ||
const char * | _eventFirstDT, | ||
const char * | _eventLastDT, | ||
const char * | _eventInterval, | ||
const char * | _eventOffset ) |
Construct new event using strings.
To initialize an event, the event name and event interval must be specified. The reference date (also known as the anchor-date), start date and event last date are optional. If first date is not specified, first date is initialized as 0-01-01T00:00:00.000. If reference date is not specified, first date is copied to reference date. If event last date is not defined, it is left as NULL and is logically equivalent to Infinity.
Notice that events trigger every _eventReferenceDT + Integral multiple of _eventInterval strictly in [_eventFirstDT,_eventLastDT].
_en | A pointer to char. This string contains the name of event. String name must be defined. |
_eventReferenceDT | A pointer to char. This string contains the Anchor date. Events are triggered at Anchor date + (N * eventInterval) where N is in Z. This can be NULL in which case Anchor Date = First Date. |
_eventFirstDT | A pointer to char. This string contains the Starting datetime (A) of the DateTime range [A-B] in which trigger is allowed. Can be NULL. |
_eventLastDT | A pointer to char. This string contains the Ending datetime (B) of the DateTime range [A-B] in which trigger is allowed. Can be NULL. If defined, events will not trigger beyond this point. Else, equivalent to infinity. |
_eventOffset | A pointer to char. Adds a logical shift to _eventReferenceDT and the sifted value is used as the anchor date. Can be NULL; Logically equivalent to 0 shift. |
_eventInterval | A pointer to char. This string contains the timestep. This must be defined for every event. |
struct _eventGroup * newEventGroup | ( | const char * | egn | ) |
Construct new event-Group using a string.
egn | A pointer to char. This string contains the name of event group. |
struct _event * newEventWithDataType | ( | const char * | _en, |
struct _datetime * | _eventReferenceDT, | ||
struct _datetime * | _eventFirstDT, | ||
struct _datetime * | _eventLastDT, | ||
struct _timedelta * | _eventInterval, | ||
struct _timedelta * | _eventOffset ) |
Construct new event using data-types.
To initialize an event, the event name and event interval must be specified. The reference date (also known as the anchor-date), start date and event last date are optional. If first date is not specified, first date is initialized as 0-01-01T00:00:00.000. If reference date is not specified, first date is copied to reference date. If event last date is not defined, it is left as NULL and is logically equivalent to Infinity.
Notice that events trigger every _eventReferenceDT + Integral multiple of _eventInterval strictly in [_eventFirstDT,_eventLastDT].
_en | A pointer to char. This string contains the name of event. |
_eventReferenceDT | A pointer to struct _datetime. This pointer contains the First Reference date also called anchor date. This can be NULL, but if defined acts as the true starting datetime overriding e->eventFirstDateTime. |
_eventFirstDT | A pointer to struct _datetime. This pointer contains the Starting datetime. This must be defined for every Event. |
_eventLastDT | A pointer to struct _datetime. This pointer contains the Ending datetime. This can be NULL. If defined, events will not trigger beyond this point. |
_eventInterval | A pointer to struct _timedelta. This pointer contains the timestep. This must be defined for every event. |
struct _julianday * newJulianDay | ( | int64_t | _day, |
int64_t | _ms ) |
Construct new Julian-Date object.
_day | An "int64_t" value denoting the Day part of JD. |
_ms | An "int64_t" value denoting the milli-second part of Date. |
struct _date * newRawDate | ( | int64_t | _year, |
int | _month, | ||
int | _day ) |
Construct new Date using 'raw' numerical values.
MAX allowed year = 2147483647 and MIN allowed year = -2147483648.
_year | An "int64_t" value denoting the year part of Date. |
_month | An "int" value denoting the month part of Date. |
_day | An "int" value denoting the day part of Date. |
struct _datetime * newRawDateTime | ( | int64_t | _year, |
int | _month, | ||
int | _day, | ||
int | _hour, | ||
int | _minute, | ||
int | _second, | ||
int | _ms ) |
Construct new DateTime using 'raw' numerical values.
_year | An "int64_t" value denoting the year part of DateTime. |
_month | An "int" value denoting the month part of DateTime. |
_day | An "int" value denoting the day part of DateTime. |
_hour | An "int" value denoting the hour part of DateTime. |
_minute | An "int" value denoting the minute part of DateTime. |
_second | An "int" value denoting the second part of DateTime. |
_ms | An "int" value denoting the milli-second part of DateTime. |
struct _time * newRawTime | ( | int | _hour, |
int | _minute, | ||
int | _second, | ||
int | _ms ) |
Construct new Time using 'raw' numerical values.
_hour | An "int" value denoting the hour part of time. |
_minute | An "int" value denoting the minute part of time. |
_second | An "int" value denoting the second part of time. |
_ms | An "int" value denoting the milli-second part of time. |
struct _timedelta * newRawTimeDelta | ( | char | _sign, |
int64_t | _year, | ||
int | _month, | ||
int | _day, | ||
int | _hour, | ||
int | _minute, | ||
int | _second, | ||
int | _ms ) |
Construct new TimeDelta using 'raw' numerical values.
_sign | An char value denoting positive('+') or negative('-') TimeDelta. |
_year | An "int64_t" value denoting the year part of TimeDelta. |
_month | An "int" value denoting the month part of TimeDelta. |
_day | An "int" value denoting the day part of TimeDelta. |
_hour | An "int" value denoting the hour part of TimeDelta. |
_minute | An "int" value denoting the minute part of TimeDelta. |
_second | An "int" value denoting the second part of TimeDelta. |
_ms | An "int" value denoting the milli-second part of TimeDelta. |
struct _time * newTime | ( | const char * | ts | ) |
Construct new Time using an ISO 8601 conforming string.
Strings of the following form are valid: <table> <tr><th> Extended Format: <th> <tr><td> HH:MM:SS.SSS <td> .SSS can be of length 1-3 <tr><td> HH:MM:SS <td> <tr><td> HH:MM <td> <tr><td> HH <td> </table> <table> <tr><th> Basic Format: </th> <tr><td> HHMMSS.SSS <td> .SSS can be of length 1-3 <tr><td> HHMMSS <td> <tr><td> HHMM <td> <tr><td> HH <td> </table> In essence, strings follow the guidelines in ISO8601 standard (but do not support all formats).
ts | A pointer to char. The string contains parameters with which Time is created. |
struct _timedelta * newTimeDelta | ( | const char * | tds | ) |
Construct new TimeDelta using an ISO 8601 conforming string.
tds | A pointer to char. The string should contain parameters with which TimeDelta is to be created. |
bool removeEventFromEventGroup | ( | char * | en, |
struct _eventGroup * | eg ) |
Remove event from eventgroup. CRITICAL: Also, deallocate the event.
en | A pointer to char. The name of event to be removed. |
eg | A pointer to struct _eventGroup. The eventGroup to which this event belongs. |
COPY a DateTime object.
Routine replaceDateTime copies the contents of source DateTime into a Destination DateTime object.
dtsrc | A pointer to struct _datetime. Copy "FROM" DateTime object. |
dtdest | A pointer to struct _datetime. Copy "TO" DateTime object. |
struct _timedelta * replaceTimeDelta | ( | struct _timedelta * | tdsrc, |
struct _timedelta * | tddest ) |
COPY a TimeDelta object.
Routine replaceTimeDelta copies the contents of source TimeDelta into a Destination TimeDelta object.
tdsrc | A pointer to struct _timedelta. Copy "FROM" TimeDelta object. |
tddest | A pointer to struct _timedelta. Copy "TO" TimeDelta object. |
void splitRepetitionString | ( | const char * | recurringTimeInterval, |
char * | repetitor, | ||
char * | start, | ||
char * | end, | ||
char * | duration ) |
Split ISO 8601:2004 repeated time interval strings into base components.
[in] | recurringTimeInterval | A pointer to char. The string should contain an ISO 8601:2004 repeated time interval string. A string literal can be accepted. |
[out] | repetitor | A string. Contains the repetitor part of the input string. |
[out] | start | A string. Contains the start date part of the input string. |
[out] | end | A string. Contains the end date part of the input string. |
[out] | duration | A string. Contains the duration part of the input string. |
char * timedeltaToString | ( | struct _timedelta * | td, |
char * | toStr ) |
Get TimeDelta as an extended string.
timedeltaToString returns a string in IS08601 compliant (and extended) format.
td | A pointer to struct _timedelta. The timedelta to be converted to string. |
toStr | A pointer to char. String where timedelta is to be written. |
char * timeToBasicString | ( | struct _time * | t, |
char * | toStr ) |
Get time as a basic string.
timetoString returns a string in IS08601 compliant format.
t | A pointer to struct _time. The time to be converted to string. |
toStr | A pointer to char. String where time is to be written. |
char * timeToPosixString | ( | struct _time * | t, |
char * | toStr, | ||
char * | fmtString ) |
Get Time in 'struct tm' format and return as a string.
t | A pointer to struct _time. The time to be converted to string. |
toStr | A pointer to char. String where time is to be written. |
fmtString | A pointer to char. Desired Format string. CRITICAL: Inappropriate fmt string will cause dump. |
char * timeToString | ( | struct _time * | t, |
char * | toStr ) |
Get time as an extended string.
timetoString returns a string in IS08601 compliant (and extended) format.
t | A pointer to struct _time. The time to be converted to string. |
toStr | A pointer to char. String where time is to be written. |