diff --git a/src/libmtime.f90 b/src/libmtime.f90 index e28411473067231d7c05a154a24cf44fc14663b1..52b2f3928fcae2cdce3e84753256236c691a6aee 100644 --- a/src/libmtime.f90 +++ b/src/libmtime.f90 @@ -2665,7 +2665,16 @@ module mtime_basic_events ! contains - !! @param[out] errno optional, error message + + !> Construct new "event_basic" using data-types. + ! + ! This data type determines the event trigger by large-integer + ! division. This is only well-defined for event frequencies smaller + ! than one month. Therefore the data type's constructor fails when + ! the event interval exceeds a certain threshold. + ! + ! @param[out] errno optional; (value /= 0) if constructor fails (see note above). + ! function newBasicEventWithDataTypes(name, & & referenceDate, & & firstdate, & @@ -2958,6 +2967,11 @@ contains ret_event%ev_basic => NULL() ret_event%ev_std => NULL() + ! The event_basic data type determines the event trigger by + ! large-integer division. This is only well-defined for event + ! frequencies smaller than one month. Therefore the data type's + ! constructor fails when the event interval exceeds a certain + ! threshold: ret_event%ev_basic => newBasicEvent(name, referenceDate, firstdate, & & lastDate, interval, res_errno, & & plus_slack, minus_slack) diff --git a/src/mtime_eventBasic.c b/src/mtime_eventBasic.c index c3fd2c374525330fb472c5482b908b3d6acdf1cf..dfe896e8c266e0efc3a01ff7e976862b5bf33a3a 100644 --- a/src/mtime_eventBasic.c +++ b/src/mtime_eventBasic.c @@ -19,7 +19,8 @@ #include "mtime_julianDay.h" #include "mtime_calendar.h" -/* this threshold defines the frequency < 1 day. */ +/* threshold (in days)of approx. 1 month, defining the maximum + feasible event frequency. */ #define BASICEVENT_THRESHOLD 25 @@ -194,14 +195,23 @@ basicEvent_cache_init(struct t_event_basic* e) /** * @brief 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. + * The data type "t_event_basic" uses a basis b=1200 representation + * for time spans and the large-integer division algorithm implemented + * in timespan_div.c and int_div.c. + * + * Determining the event trigger by division is only well-defined for + * event frequencies smaller than one month. Therefore the data type's + * constructor fails when the event interval exceeds a certain + * threshold. * + * Further notes: 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]. * @@ -306,9 +316,8 @@ newBasicEventWithDataType(const char* _en, /* --- consistency checks --- */ - /* check if the event interval is smaller than one month - (otherwise this cannot be handled by the basic event - object). */ + /* check if the event interval is sufficiently small (otherwise + this cannot be handled by the basic event object). */ if (e->cache->jd_eventInterval.day > BASICEVENT_THRESHOLD) { /* Interval cannot be handled by basic event object */ goto cleanup_and_exit;