OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
openswmm::datetime Namespace Reference

Typedefs

using DateTime = double
 

Functions

void divMod (int n, int d, int *result, int *remainder)
 Integer divmod — matching legacy divMod().
 
bool isLeapYear (int year)
 Check if year is a leap year.
 
DateTime encodeDate (int year, int month, int day)
 Encode year-month-day to DateTime.
 
DateTime encodeTime (int hour, int minute, int second)
 Encode hour:minute:second to fractional day.
 
void decodeDate (DateTime date, int &year, int &month, int &day)
 Decode DateTime to year-month-day.
 
void decodeTime (DateTime time, int &h, int &m, int &s)
 Decode DateTime to hour:minute:second.
 
DateTime addSeconds (DateTime date, double seconds)
 Add seconds to a DateTime — numerically identical to legacy.
 
long timeDiff (DateTime date1, DateTime date2)
 Compute difference in seconds between two DateTimes.
 
int monthOfYear (DateTime date)
 Get month of year (1..12) from DateTime.
 
int dayOfYear (DateTime date)
 Get day of year (1..365/366) from DateTime.
 

Typedef Documentation

◆ DateTime

using openswmm::datetime::DateTime = typedef double

Function Documentation

◆ addSeconds()

DateTime openswmm::datetime::addSeconds ( DateTime  date,
double  seconds 
)
inline

Add seconds to a DateTime — numerically identical to legacy.

See also
Legacy: datetime_addSeconds() in datetime.c

Decomposes time to integer H:M:S, adds seconds, recomposes. This decompose-recompose cycle is deterministic and produces the exact same floating-point result as the legacy engine.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dayOfYear()

int openswmm::datetime::dayOfYear ( DateTime  date)
inline

Get day of year (1..365/366) from DateTime.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decodeDate()

void openswmm::datetime::decodeDate ( DateTime  date,
int &  year,
int &  month,
int &  day 
)
inline

Decode DateTime to year-month-day.

See also
Legacy: datetime_decodeDate() in datetime.c
Here is the call graph for this function:
Here is the caller graph for this function:

◆ decodeTime()

void openswmm::datetime::decodeTime ( DateTime  time,
int &  h,
int &  m,
int &  s 
)
inline

Decode DateTime to hour:minute:second.

See also
Legacy: datetime_decodeTime() in datetime.c

Uses floor(fracDay + 0.5) for rounding, matching legacy exactly. This integer decomposition is the key to deterministic date arithmetic.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ divMod()

void openswmm::datetime::divMod ( int  n,
int  d,
int *  result,
int *  remainder 
)
inline

Integer divmod — matching legacy divMod().

Here is the caller graph for this function:

◆ encodeDate()

DateTime openswmm::datetime::encodeDate ( int  year,
int  month,
int  day 
)
inline

Encode year-month-day to DateTime.

See also
Legacy: datetime_encodeDate() in datetime.c
Here is the call graph for this function:
Here is the caller graph for this function:

◆ encodeTime()

DateTime openswmm::datetime::encodeTime ( int  hour,
int  minute,
int  second 
)
inline

Encode hour:minute:second to fractional day.

See also
Legacy: datetime_encodeTime() in datetime.c
Here is the caller graph for this function:

◆ isLeapYear()

bool openswmm::datetime::isLeapYear ( int  year)
inline

Check if year is a leap year.

Here is the caller graph for this function:

◆ monthOfYear()

int openswmm::datetime::monthOfYear ( DateTime  date)
inline

Get month of year (1..12) from DateTime.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ timeDiff()

long openswmm::datetime::timeDiff ( DateTime  date1,
DateTime  date2 
)
inline

Compute difference in seconds between two DateTimes.

See also
Legacy: datetime_timeDiff() in datetime.c
Here is the call graph for this function: