OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
openswmm_datetime.h
Go to the documentation of this file.
1
52#ifndef OPENSWMM_ENGINE_DATETIME_H
53#define OPENSWMM_ENGINE_DATETIME_H
54
55#include "openswmm_engine_export.h"
56
57#ifdef __cplusplus
58extern "C" {
59#endif
60
61/* =========================================================================
62 * Epoch constant
63 * ========================================================================= */
64
72#define SWMM_DATETIME_DATE_DELTA 693594
73
74/* =========================================================================
75 * Encode (calendar parts -> SWMM DateTime double)
76 * ========================================================================= */
77
90SWMM_ENGINE_API int swmm_datetime_encode_date(int year, int month, int day,
91 double* out);
92
105SWMM_ENGINE_API int swmm_datetime_encode_time(int hour, int minute, int second,
106 double* out);
107
108/* =========================================================================
109 * Decode (SWMM DateTime double -> calendar parts)
110 * ========================================================================= */
111
123 int* year, int* month, int* day);
124
140 int* hour, int* minute, int* second);
141
142/* =========================================================================
143 * DateTime arithmetic
144 * ========================================================================= */
145
159SWMM_ENGINE_API int swmm_datetime_add_seconds(double value, double seconds,
160 double* out);
161
171SWMM_ENGINE_API int swmm_datetime_time_diff(double value1, double value2,
172 long* out);
173
174#ifdef __cplusplus
175} /* extern "C" */
176#endif
177
178#endif /* OPENSWMM_ENGINE_DATETIME_H */
#define SWMM_ENGINE_API
Definition openswmm_2d.h:37
SWMM_ENGINE_API int swmm_datetime_encode_time(int hour, int minute, int second, double *out)
Encode a wall-clock time as the fractional-day part of a SWMM DateTime.
Definition openswmm_datetime_impl.cpp:30
SWMM_ENGINE_API int swmm_datetime_decode_date(double value, int *year, int *month, int *day)
Decode the date portion of a SWMM DateTime.
Definition openswmm_datetime_impl.cpp:41
SWMM_ENGINE_API int swmm_datetime_encode_date(int year, int month, int day, double *out)
Encode a calendar date as a SWMM DateTime (date portion only).
Definition openswmm_datetime_impl.cpp:22
SWMM_ENGINE_API int swmm_datetime_add_seconds(double value, double seconds, double *out)
Add a (possibly fractional) number of seconds to a SWMM DateTime.
Definition openswmm_datetime_impl.cpp:63
SWMM_ENGINE_API int swmm_datetime_time_diff(double value1, double value2, long *out)
Compute the difference, in whole seconds, between two SWMM DateTimes.
Definition openswmm_datetime_impl.cpp:70
SWMM_ENGINE_API int swmm_datetime_decode_time(double value, int *hour, int *minute, int *second)
Decode the time-of-day portion of a SWMM DateTime.
Definition openswmm_datetime_impl.cpp:52