11 static char *months[] = {
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
12 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"};
44 sprintf(temp,
"%d", n);
51 strcat(buf, months[n - 1]);
57 sprintf(temp,
"%d", n);
66 sprintf(temp,
"%02d", n);
73 sprintf(temp,
"%02d", n);
82 sprintf(temp,
"%02.*f", n, sec);
92 sprintf(temp,
"%s%02d%02d", n < 0 ?
"-" :
"+", hour, minute);
104 sprintf(temp,
"%d year%s", n, n == 1 ?
"" :
"s");
111 sprintf(temp,
"%d month%s", n, n == 1 ?
"" :
"s");
118 sprintf(temp,
"%d day%s", n, n == 1 ?
"" :
"s");
125 sprintf(temp,
"%d hour%s", n, n == 1 ?
"" :
"s");
132 sprintf(temp,
"%d minute%s", n, n == 1 ?
"" :
"s");
141 sprintf(temp,
"%.*f second%s", n, sec,
142 (sec == 1.0 && n == 0) ?
"" :
"s");
int datetime_is_negative(const DateTime *dt)
Returns: 1 if the DateTime is negative 0 otherwise.
int datetime_get_second(const DateTime *dt, double *second)
returns 0 on success or negative value on error
int datetime_get_fracsec(const DateTime *dt, int *fracsec)
returns 0 on success or negative value on error
int datetime_get_timezone(const DateTime *dt, int *minutes)
returns 0 on success
int datetime_is_valid_type(const DateTime *dt)
Returns: 1 if datetime_check_type() returns 0 0 if not.
int datetime_error_code(void)
returns an error code
int datetime_is_absolute(const DateTime *dt)
Returns: 1 if dt.mode is absolute 0 if not (even if dt.mode is not defined)
int datetime_get_hour(const DateTime *dt, int *hour)
returns 0 on success or negative value on error
int datetime_get_year(const DateTime *dt, int *year)
returns 0 on success or negative value on error
int datetime_is_relative(const DateTime *dt)
Returns: 1 if dt.mode is relative 0 if not (even if dt.mode is not defined)
int datetime_get_minute(const DateTime *dt, int *minute)
returns 0 on success or negative value on error
int datetime_get_day(const DateTime *dt, int *day)
returns 0 on success or negative value on error
int datetime_get_month(const DateTime *dt, int *month)
returns 0 on success or negative value on error
void datetime_decompose_timezone(int tz, int *hours, int *minutes)
tz = abs(tz) *hour = tz/60 *minute = tz%60 Note: hour,minute are non-negative. Must look at sign of t...