![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Typedefs | |
| using | DateTime = double |
Functions | |
| void | divMod (int n, int d, int *result, int *remainder) |
| Divide integers with the legacy zero-divisor convention. | |
| bool | isLeapYear (int year) |
| Test the proleptic Gregorian leap-year rule. | |
| DateTime | encodeDate (int year, int month, int day) |
| Encode a Gregorian calendar date as midnight in SWMM days. | |
| DateTime | encodeTime (int hour, int minute, int second) |
| Convert nonnegative time components to an elapsed-day fraction. | |
| void | decodeDate (DateTime date, int &year, int &month, int &day) |
| Decode the whole-day part of a SWMM DateTime. | |
| void | decodeTime (DateTime time, int &h, int &m, int &s) |
| Decode a SWMM day fraction to the nearest whole second. | |
| DateTime | addSeconds (DateTime date, double seconds) |
| Add an offset after rounding the input time to whole seconds. | |
| long | timeDiff (DateTime date1, DateTime date2) |
| Subtract two SWMM DateTimes using whole-second decoded times. | |
| int | monthOfYear (DateTime date) |
| Extract the month from a SWMM DateTime. | |
| int | dayOfYear (DateTime date) |
| Extract the ordinal day from a SWMM DateTime. | |
| using openswmm::datetime::DateTime = double |
Add an offset after rounding the input time to whole seconds.
| [in] | date | Finite SWMM DateTime in days relative to 1899-12-30. |
| [in] | seconds | Finite seconds to add; negative and fractional offsets are accepted, and the result may cross any number of day boundaries. |
Decodes the input using decodeTime(), then recomposes the day and time. The decompose/recompose sequence matches legacy arithmetic; subsecond precision already present in date is not retained.
|
inline |
Extract the ordinal day from a SWMM DateTime.
| [in] | date | Finite SWMM DateTime for a valid Gregorian date encoded by encodeDate(); the time-of-day does not affect the result. |
|
inline |
Decode the whole-day part of a SWMM DateTime.
| [in] | date | Finite SWMM days relative to 1899-12-30; fractional days are discarded with floor(), including for dates before the epoch. |
| [out] | year | Decoded Gregorian year; zero for dates before 0001-01-01. |
| [out] | month | One-based month; 1 for dates before 0001-01-01. |
| [out] | day | One-based day of month; 1 for dates before 0001-01-01. |
|
inline |
Decode a SWMM day fraction to the nearest whole second.
| [in] | time | Finite SWMM DateTime; only time - floor(time) is used. |
| [out] | h | Hour in [0, 23]. |
| [out] | m | Minute in [0, 59]. |
| [out] | s | Second in [0, 59]. |
Rounds fractional-day seconds with floor(seconds + 0.5). A value rounding to 86400 is clamped to 86399 rather than carrying into the next date. This matches legacy datetime_decodeTime().
|
inline |
Divide integers with the legacy zero-divisor convention.
| [in] | n | Dividend; n / d must be representable as int when d is nonzero. |
| [in] | d | Divisor; zero requests zero quotient and remainder. |
| [out] | result | Non-null writable quotient, truncated toward zero. |
| [out] | remainder | Non-null writable n - d * quotient; zero when d is zero. |
|
inline |
Encode a Gregorian calendar date as midnight in SWMM days.
| [in] | year | Year in [1, 9999]. |
| [in] | month | Month in [1, 12]. |
| [in] | day | One-based day valid for the specified month and leap year. |
|
inline |
Convert nonnegative time components to an elapsed-day fraction.
| [in] | hour | Nonnegative hours; values above 23 are accepted. |
| [in] | minute | Nonnegative minutes; values above 59 are accepted. |
| [in] | second | Nonnegative seconds; values above 59 are accepted. |
|
inline |
Test the proleptic Gregorian leap-year rule.
| [in] | year | Calendar year to test; the arithmetic rule also accepts year zero. |
|
inline |
Extract the month from a SWMM DateTime.
| [in] | date | Finite SWMM DateTime for a valid Gregorian date encoded by encodeDate(); the time-of-day does not affect the result. |
Subtract two SWMM DateTimes using whole-second decoded times.
| [in] | date1 | Finite minuend in SWMM days; need not be later than date2. |
| [in] | date2 | Finite subtrahend in SWMM days. |