9 #include <grass/datetime.h>
12 static char *months[] = {
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
13 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
53 strcat(buf, months[n - 1]);
84 sprintf(temp,
"%02.*f", n, sec);
94 sprintf(temp,
"%s%02d%02d", n < 0 ?
"-" :
"+", hour, minute);
106 sprintf(temp,
"%d year%s", n, n == 1 ?
"" :
"s");
113 sprintf(temp,
"%d month%s", n, n == 1 ?
"" :
"s");
120 sprintf(temp,
"%d day%s", n, n == 1 ?
"" :
"s");
127 sprintf(temp,
"%d hour%s", n, n == 1 ?
"" :
"s");
134 sprintf(temp,
"%d minute%s", n, n == 1 ?
"" :
"s");
143 sprintf(temp,
"%.*f second%s", n, sec,
144 (sec == 1.0 && n == 0) ?
"" :
"s");
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
int datetime_get_month(const DateTime *dt, int *month)
returns 0 on success or negative value on error
int datetime_get_second(const DateTime *dt, double *second)
returns 0 on success or negative value on error
int datetime_error_code(void)
returns an error code
int datetime_get_day(const DateTime *dt, int *day)
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_hour(const DateTime *dt, int *hour)
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_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_minute(const DateTime *dt, int *minute)
returns 0 on success or negative value on error
int datetime_get_timezone(const DateTime *dt, int *minutes)
returns 0 on success
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
int datetime_is_negative(const DateTime *dt)
Returns: 1 if the DateTime is negative 0 otherwise.
int datetime_is_valid_type(const DateTime *dt)
Returns: 1 if datetime_check_type() returns 0 0 if not.
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...