RWDBDuration
Class RWDBDuration represents a time span, stored in a double as a number of seconds. All reasonable arithmetic operations involving time spans are supported, including addition and subtraction, multiplication by a constant, incrementation by seconds, minutes, hours, and so forth.
RWDBDuration also supports arithmetic operations involving the imprecise quantities months and years, whose exact number of days vary. The DB Interface Module supports these operations using the following conversions:
Table 12 – Time conversions in RWDBDuration
Time Span
const double RWDBDuration::DUR_MILLISECONDS_PER_SEC = ((double)1000.0);
const double RWDBDuration::DUR_SECONDS_PER_MIN = ((double)60.0);
const double RWDBDuration::DUR_SECONDS_PER_HR = ((double)3600.0);
const double RWDBDuration::DUR_SECONDS_PER_DAY = ((double)86400.0);
const double RWDBDuration::DUR_SECONDS_PER_WEEK = ((double)604800.0);
const double RWDBDuration::DUR_SECONDS_PER_RWMTH = ((double)2419200.0);
const double RWDBDuration::DUR_SECONDS_PER_RWYR = ((double)29030400.0);
From the table, we see that adding one month to an RWDBDuration adds four weeks' worth of seconds to the duration, regardless of the number of weeks in any particular month.
As a reminder of this interpretation, the methods for accessing years and months are named asRWMonths() and asRWYears(). Applications can apply specialized arithmetic for durations that span more than one month or year by using the arithmetic operators for doubles.