![]() |
OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
|
Header file for date and time functions. More...
Go to the source code of this file.
Macros | |
| #define | Y_M_D 0 |
| Date format: year, month, day. | |
| #define | M_D_Y 1 |
| Date format: month, day, year. | |
| #define | D_M_Y 2 |
| Date format: day, month, year. | |
| #define | NO_DATE -693594 |
| No date value. | |
| #define | DATE_STR_SIZE 12 |
| Size of a date string. | |
| #define | TIME_STR_SIZE 9 |
| Size of a time string. | |
| #define | TIME_STAMP_SIZE 21 |
| Size of a time stamp string. | |
Typedefs | |
| typedef double | DateTime |
| Type for storing date and time values. | |
Functions | |
| DateTime | datetime_encodeDate (int year, int month, int day) |
| Encodes a date values from year, month, and day to a DateTime value. | |
| DateTime | datetime_encodeTime (int hour, int minute, int second) |
| Encodes a time value from hour, minute, and second to a DateTime value. | |
| void | datetime_decodeDate (DateTime date, int *y, int *m, int *d) |
| Decodes a DateTime value to year, month, and day. | |
| void | datetime_decodeTime (DateTime time, int *h, int *m, int *s) |
| Decodes a DateTime value to hour, minute, and second. | |
| int | datetime_monthOfYear (DateTime date) |
| Finds the month of the year for a date. | |
| int | datetime_dayOfYear (DateTime date) |
| Finds the day of the year for a date. | |
| int | datetime_dayOfWeek (DateTime date) |
| Finds the day of the week for a date. | |
| int | datetime_hourOfDay (DateTime date) |
| Finds the hour of the day for a time. | |
| int | datetime_daysPerMonth (int year, int month) |
| Finds the number of days in a month. | |
| void | datetime_dateToStr (DateTime date, char *s) |
| Converts a DateTime value to a string. | |
| void | datetime_timeToStr (DateTime time, char *s) |
| Converts a DateTime value to a string. | |
| void | datetime_getTimeStamp (int fmt, DateTime aDate, int stampSize, char *timeStamp) |
| Converts a DateTime value to a string. | |
| int | datetime_findMonth (char *s) |
| Finds the month of the year for a date. | |
| int | datetime_strToDate (char *s, DateTime *d) |
| Converts a string to a DateTime value. | |
| int | datetime_strToTime (char *s, DateTime *t) |
| Converts a string to a DateTime value. | |
| void | datetime_setDateFormat (int fmt) |
| Sets the date format. | |
| DateTime | datetime_addSeconds (DateTime date1, double seconds) |
| Adds seconds to a DateTime value. | |
| DateTime | datetime_addDays (DateTime date1, DateTime date2) |
| Adds days to a DateTime value. | |
| long | datetime_timeDiff (DateTime date1, DateTime date2) |
| Finds the difference in seconds between two DateTime values. | |
Header file for date and time functions.
The DateTime type is used to store date and time values. It is equivalent to a double floating point type.
The integral part of a DateTime value is the number of days that have passed since 12/31/1899. The fractional part of a DateTime value is the fraction of a 24 hour day that has elapsed.
Build 5.1.011:
| #define D_M_Y 2 |
Date format: day, month, year.
| #define DATE_STR_SIZE 12 |
Size of a date string.
| #define M_D_Y 1 |
Date format: month, day, year.
| #define NO_DATE -693594 |
No date value.
| #define TIME_STAMP_SIZE 21 |
Size of a time stamp string.
| #define TIME_STR_SIZE 9 |
Size of a time string.
| #define Y_M_D 0 |
Date format: year, month, day.
Type for storing date and time values.
Adds days to a DateTime value.
| [in] | date1 | Date value |
| [in] | days | Number of days to add |
Adds seconds to a DateTime value.
| [in] | date1 | Date value |
| [in] | seconds | Number of seconds to add |
| void datetime_dateToStr | ( | DateTime | date, |
| char * | s | ||
| ) |
Converts a DateTime value to a string.
| [in] | date | Date value |
| [out] | s | String to store the date |
| int datetime_dayOfWeek | ( | DateTime | date | ) |
Finds the day of the week for a date.
| [in] | date | Date value |
| int datetime_dayOfYear | ( | DateTime | date | ) |
Finds the day of the year for a date.
| [in] | date | Date value |
| int datetime_daysPerMonth | ( | int | year, |
| int | month | ||
| ) |
Finds the number of days in a month.
| [in] | year | Year |
| [in] | month | Month |
| void datetime_decodeDate | ( | DateTime | date, |
| int * | y, | ||
| int * | m, | ||
| int * | d | ||
| ) |
Decodes a DateTime value to year, month, and day.
| [in] | date | Date value |
| [out] | y | Year |
| [out] | m | Month |
| [out] | d | Day |
| void datetime_decodeTime | ( | DateTime | time, |
| int * | h, | ||
| int * | m, | ||
| int * | s | ||
| ) |
Decodes a DateTime value to hour, minute, and second.
| [in] | time | Time value |
| [out] | h | Hour |
| [out] | m | Minute |
| [out] | s | Second |
| DateTime datetime_encodeDate | ( | int | year, |
| int | month, | ||
| int | day | ||
| ) |
Encodes a date values from year, month, and day to a DateTime value.
| [in] | year | Year |
| [in] | month | Month |
| [in] | day | Day |
| DateTime datetime_encodeTime | ( | int | hour, |
| int | minute, | ||
| int | second | ||
| ) |
Encodes a time value from hour, minute, and second to a DateTime value.
| [in] | hour | Hour |
| [in] | minute | Minute |
| [in] | second | Second |
| int datetime_findMonth | ( | char * | s | ) |
Finds the month of the year for a date.
| [in] | s | String date |
| void datetime_getTimeStamp | ( | int | fmt, |
| DateTime | aDate, | ||
| int | stampSize, | ||
| char * | timeStamp | ||
| ) |
Converts a DateTime value to a string.
| [in] | date | Date value |
| [in] | time | Time value |
| [out] | s | String to store the date and time |
| int datetime_hourOfDay | ( | DateTime | date | ) |
Finds the hour of the day for a time.
| [in] | time | Time value |
| int datetime_monthOfYear | ( | DateTime | date | ) |
Finds the month of the year for a date.
| [in] | date | Date value |
| void datetime_setDateFormat | ( | int | fmt | ) |
Sets the date format.
| [in] | fmt | Date format |
| int datetime_strToDate | ( | char * | s, |
| DateTime * | d | ||
| ) |
Converts a string to a DateTime value.
| [in] | s | String date |
| [out] | d | DateTime value |
| int datetime_strToTime | ( | char * | s, |
| DateTime * | t | ||
| ) |
Converts a string to a DateTime value.
| [in] | s | String time |
| [out] | t | DateTime value |
Finds the difference in seconds between two DateTime values.
| [in] | date1 | First date value |
| [in] | date2 | Second date value |
| void datetime_timeToStr | ( | DateTime | time, |
| char * | s | ||
| ) |
Converts a DateTime value to a string.
| [in] | time | Time value |
| [out] | s | String to store the time |