![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Legacy SWMM date and time representation and arithmetic. More...
Macros | |
| #define | _CRT_SECURE_NO_DEPRECATE |
| #define | UCHAR(x) |
Functions | |
| void | divMod (int n, int d, int *result, int *remainder) |
| Divide two integers with legacy zero-divisor handling. | |
| int | isLeapYear (int year) |
| Apply the Gregorian divisible-by-four/century/400-year leap rule. | |
| int | datetime_findMonth (char *month) |
| Match the first three letters of an English month name. | |
| DateTime | datetime_encodeDate (int year, int month, int day) |
| Encode a Gregorian date as midnight in SWMM calendar days. | |
| DateTime | datetime_encodeTime (int hour, int minute, int second) |
| Convert nonnegative hour/minute/second components to elapsed days. | |
| void | datetime_decodeDate (DateTime date, int *year, int *month, int *day) |
| Decode a SWMM whole-day value into Gregorian date components. | |
| void | datetime_decodeTime (DateTime time, int *h, int *m, int *s) |
| Round a SWMM day fraction to whole-second clock components. | |
| void | datetime_dateToStr (DateTime date, char *s) |
| Format the date portion of a SWMM DateTime with the shared DateFormat. | |
| void | datetime_timeToStr (DateTime time, char *s) |
| Format the rounded time-of-day portion as HH:MM:SS. | |
| int | datetime_strToDate (char *s, DateTime *d) |
| Parse a calendar date using the shared date-format setting. | |
| int | datetime_strToTime (char *s, DateTime *t) |
| Parse decimal hours or nonnegative colon-separated clock components. | |
| void | datetime_setDateFormat (int fmt) |
| Select the shared calendar text field order. | |
| DateTime | datetime_addSeconds (DateTime date1, double seconds) |
| Add seconds after rounding the input time to the legacy whole-second clock. | |
| DateTime | datetime_addDays (DateTime date1, DateTime date2) |
| Add two day values after rounding each fractional part to whole seconds. | |
| long | datetime_timeDiff (DateTime date1, DateTime date2) |
| Subtract two dates using separately rounded whole-second clock values. | |
| int | datetime_monthOfYear (DateTime date) |
| Extract the month from a SWMM DateTime. | |
| int | datetime_dayOfYear (DateTime date) |
| Extract the day of year from a SWMM DateTime. | |
| int | datetime_dayOfWeek (DateTime date) |
| Extract the day of week from a SWMM DateTime. | |
| int | datetime_hourOfDay (DateTime date) |
| Extract the hour from a SWMM DateTime. | |
| int | datetime_daysPerMonth (int year, int month) |
| Find a Gregorian month's length using the leap-year rule. | |
| void | datetime_getTimeStamp (int fmt, DateTime aDate, int stampSize, char *timeStamp) |
| Format SWMM calendar days as a date and whole-second time stamp. | |
Legacy SWMM date and time representation and arithmetic.
| #define _CRT_SECURE_NO_DEPRECATE |
| #define UCHAR | ( | x | ) |
Add two day values after rounding each fractional part to whole seconds.
Adds days to a DateTime value.
Add seconds after rounding the input time to the legacy whole-second clock.
Adds seconds to a DateTime value.
| void datetime_dateToStr | ( | DateTime | date, |
| char * | s ) |
Format the date portion of a SWMM DateTime with the shared DateFormat.
Converts a DateTime value to a string.
| int datetime_dayOfWeek | ( | DateTime | date | ) |
Extract the day of week from a SWMM DateTime.
Finds the day of the week for a date.
| int datetime_dayOfYear | ( | DateTime | date | ) |
Extract the day of year from a SWMM DateTime.
Finds the day of the year for a date.
| int datetime_daysPerMonth | ( | int | year, |
| int | month ) |
Find a Gregorian month's length using the leap-year rule.
Finds the number of days in a month.
| void datetime_decodeDate | ( | DateTime | date, |
| int * | year, | ||
| int * | month, | ||
| int * | day ) |
Decode a SWMM whole-day value into Gregorian date components.
Decodes a DateTime value to year, month, and day.
| void datetime_decodeTime | ( | DateTime | time, |
| int * | h, | ||
| int * | m, | ||
| int * | s ) |
Round a SWMM day fraction to whole-second clock components.
Decodes a DateTime value to hour, minute, and second.
| DateTime datetime_encodeDate | ( | int | year, |
| int | month, | ||
| int | day ) |
Encode a Gregorian date as midnight in SWMM calendar days.
Encodes a date values from year, month, and day to a DateTime value.
| DateTime datetime_encodeTime | ( | int | hour, |
| int | minute, | ||
| int | second ) |
Convert nonnegative hour/minute/second components to elapsed days.
Encodes a time value from hour, minute, and second to a DateTime value.
| int datetime_findMonth | ( | char * | month | ) |
Match the first three letters of an English month name.
Finds the month of the year for a date.
| void datetime_getTimeStamp | ( | int | fmt, |
| DateTime | aDate, | ||
| int | stampSize, | ||
| char * | timeStamp ) |
Format SWMM calendar days as a date and whole-second time stamp.
Format a calendar date and whole-second clock time in caller storage.
| int datetime_hourOfDay | ( | DateTime | date | ) |
Extract the hour from a SWMM DateTime.
Finds the hour of the day for a time.
| int datetime_monthOfYear | ( | DateTime | date | ) |
Extract the month from a SWMM DateTime.
Finds the month of the year for a date.
| void datetime_setDateFormat | ( | int | fmt | ) |
Select the shared calendar text field order.
Sets the date format.
| int datetime_strToDate | ( | char * | s, |
| DateTime * | d ) |
Parse a calendar date using the shared date-format setting.
Converts a string to a DateTime value.
| int datetime_strToTime | ( | char * | s, |
| DateTime * | t ) |
Parse decimal hours or nonnegative colon-separated clock components.
Converts a string to a DateTime value.
Subtract two dates using separately rounded whole-second clock values.
Finds the difference in seconds between two DateTime values.
| void datetime_timeToStr | ( | DateTime | time, |
| char * | s ) |
Format the rounded time-of-day portion as HH:MM:SS.
Converts a DateTime value to a string.
| void divMod | ( | int | n, |
| int | d, | ||
| int * | result, | ||
| int * | remainder ) |
Divide two integers with legacy zero-divisor handling.
| [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 distinct caller-owned quotient slot, truncated toward zero. |
| [out] | remainder | Non-null distinct caller-owned remainder slot, n - d * quotient. |
| int isLeapYear | ( | int | year | ) |
Apply the Gregorian divisible-by-four/century/400-year leap rule.
| [in] | year | Calendar year; the arithmetic rule also accepts year zero. |