43 static int _datetime_ymd_to_ddays(
const DateTime *,
double *);
99 "only one opperand contains valid timezone");
106 compare = _datetime_compare(&ta, &tb);
137 result->
month = dm + 12;
142 double latedays, earlydays;
145 _datetime_ymd_to_ddays(early, &earlydays);
147 erel.
day = earlydays;
153 _datetime_ymd_to_ddays(late, &latedays);
192 for (i = a->
from; i <= a->to; i++) {
198 else if (a->
second <
b->second)
205 else if (a->
minute <
b->minute)
210 if (a->
hour >
b->hour)
212 else if (a->
hour <
b->hour)
219 else if (a->
day <
b->day)
226 else if (a->
month <
b->month)
232 if (a->
year >
b->year)
234 else if (a->
year <
b->year)
238 if (a->
year <
b->year)
240 else if (a->
year >
b->year)
251 static int _datetime_ymd_to_ddays(
const DateTime *dtymd,
double *days)
258 *days = dtymd->
day - 1;
259 for (mo = dtymd->
month - 1; mo > 0; mo--) {
262 for (yr = dtymd->
year - 1; yr > 0; yr--) {
267 for (yr = dtymd->
year - 1; yr > 0; yr--) {
270 for (mo = 12; mo >= dtymd->
month;
#define DATETIME_RELATIVE
int datetime_change_to_utc(DateTime *dt)
Return datetime_change_timezone (dt, 0);.
int datetime_error(int code, char *msg)
record 'code' and 'msg' as error code/msg (in static variables) code==0 will clear the error (ie set ...
int datetime_get_timezone(const DateTime *dt, int *minutes)
returns 0 on success
int datetime_days_in_month(int year, int month, int ad)
returns number of days in 'month' of a particular 'year'
int datetime_set_type(DateTime *dt, int mode, int from, int to, int fracsec)
void datetime_invert_sign(DateTime *dt)
int datetime_increment(DateTime *src, DateTime *incr)
This function changes the 'src' date/time data based on the 'incr' The type (mode/from/to) of the 'sr...
int datetime_change_from_to(DateTime *dt, int from, int to, int round)
Changes the from/to of the type for dt. The 'from/to' must be legal values for the mode of dt; (if th...
int datetime_set_increment_type(const DateTime *src, DateTime *incr)
src must be legal This is a convenience routine which is implemented as follows:
int datetime_days_in_year(int year, int ad)
returns the number of days in 'year'
int datetime_in_interval_year_month(int x)
void datetime_copy(DateTime *src, const DateTime *dst)
Copies the DateTime [into/from ???] src.
int compare(const void *a, const void *b)
int datetime_difference(const DateTime *a, const DateTime *b, DateTime *result)
This performs the formula: result = a - b;.