GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
values.c File Reference
#include <grass/datetime.h>
Include dependency graph for values.c:

Go to the source code of this file.

Functions

int datetime_check_year (const DateTime *dt, int year)
 Returns: 0 is legal year for dt -1 illegal year for this dt -2 dt has no year component. More...
 
int datetime_check_month (const DateTime *dt, int month)
 Returns: 0 is legal month for dt -1 illegal month for this dt -2 dt has no month component. More...
 
int datetime_check_day (const DateTime *dt, int day)
 Returns: 0 is legal day for dt -1 illegal day for this dt -2 dt has no day component
Note: if dt.mode is ABSOLUTE, then dt.year and dt.month must also be legal, since the 'day' must be a legal value for the dt.year/dt.month. More...
 
int datetime_check_hour (const DateTime *dt, int hour)
 returns: 0 on success -1 if 'dt' has an invalid hour -2 if 'dt' has no hour More...
 
int datetime_check_minute (const DateTime *dt, int minute)
 returns: 0 on success -1 if 'dt' has an invalid minute -2 if 'dt' has no minute More...
 
int datetime_check_second (const DateTime *dt, double second)
 returns: 0 on success -1 if 'dt' has an invalid second -2 if 'dt' has no second More...
 
int datetime_check_fracsec (const DateTime *dt, int fracsec)
 returns: 0 on success -1 if 'dt' has an invalid fracsec -2 if 'dt' has no fracsec More...
 
int datetime_get_year (const DateTime *dt, int *year)
 returns 0 on success or negative value on error More...
 
int datetime_set_year (DateTime *dt, int year)
 if dt.mode = ABSOLUTE, this also sets dt.day = 0 More...
 
int datetime_get_month (const DateTime *dt, int *month)
 returns 0 on success or negative value on error More...
 
int datetime_set_month (DateTime *dt, int month)
 if dt.mode = ABSOLUTE, this also sets dt.day = 0 More...
 
int datetime_get_day (const DateTime *dt, int *day)
 returns 0 on success or negative value on error More...
 
int datetime_set_day (DateTime *dt, int day)
 if dt.mode = ABSOLUTE, then the dt.year, dt.month: More...
 
int datetime_get_hour (const DateTime *dt, int *hour)
 returns 0 on success or negative value on error More...
 
int datetime_set_hour (DateTime *dt, int hour)
 returns 0 on success or negative value on error More...
 
int datetime_get_minute (const DateTime *dt, int *minute)
 returns 0 on success or negative value on error More...
 
int datetime_set_minute (DateTime *dt, int minute)
 returns 0 on success or negative value on error More...
 
int datetime_get_second (const DateTime *dt, double *second)
 returns 0 on success or negative value on error More...
 
int datetime_set_second (DateTime *dt, double second)
 returns 0 on success or negative value on error More...
 
int datetime_get_fracsec (const DateTime *dt, int *fracsec)
 returns 0 on success or negative value on error More...
 
int datetime_set_fracsec (DateTime *dt, int fracsec)
 returns 0 on success or negative value on error More...
 

Function Documentation

int datetime_check_day ( const DateTime *  dt,
int  day 
)

Returns: 0 is legal day for dt -1 illegal day for this dt -2 dt has no day component
Note: if dt.mode is ABSOLUTE, then dt.year and dt.month must also be legal, since the 'day' must be a legal value for the dt.year/dt.month.

Parameters
dt
day
Returns
int

Definition at line 91 of file values.c.

References datetime_days_in_month(), datetime_error(), datetime_get_month(), datetime_get_year(), datetime_is_absolute(), datetime_is_positive(), and stat.

Referenced by datetime_get_day(), and datetime_set_day().

int datetime_check_fracsec ( const DateTime *  dt,
int  fracsec 
)

returns: 0 on success -1 if 'dt' has an invalid fracsec -2 if 'dt' has no fracsec

Parameters
dt
fracsec
Returns
int

Definition at line 207 of file values.c.

References datetime_error().

Referenced by datetime_get_fracsec(), and datetime_set_fracsec().

int datetime_check_hour ( const DateTime *  dt,
int  hour 
)

returns: 0 on success -1 if 'dt' has an invalid hour -2 if 'dt' has no hour

Parameters
dt
hour
Returns
int

Definition at line 129 of file values.c.

References datetime_error().

Referenced by datetime_get_hour(), and datetime_set_hour().

int datetime_check_minute ( const DateTime *  dt,
int  minute 
)

returns: 0 on success -1 if 'dt' has an invalid minute -2 if 'dt' has no minute

Parameters
dt
minute
Returns
int

Definition at line 155 of file values.c.

References datetime_error().

Referenced by datetime_get_minute(), and datetime_set_minute().

int datetime_check_month ( const DateTime *  dt,
int  month 
)

Returns: 0 is legal month for dt -1 illegal month for this dt -2 dt has no month component.

Parameters
dt
month
Returns
int

Definition at line 55 of file values.c.

References datetime_error(), datetime_is_absolute(), and datetime_is_relative().

Referenced by datetime_get_month(), and datetime_set_month().

int datetime_check_second ( const DateTime *  dt,
double  second 
)

returns: 0 on success -1 if 'dt' has an invalid second -2 if 'dt' has no second

Parameters
dt
second
Returns
int

Definition at line 181 of file values.c.

References datetime_error().

Referenced by datetime_get_second(), and datetime_set_second().

int datetime_check_year ( const DateTime *  dt,
int  year 
)

Returns: 0 is legal year for dt -1 illegal year for this dt -2 dt has no year component.

Parameters
dt
year
Returns
int

Definition at line 29 of file values.c.

References datetime_error(), and datetime_is_absolute().

Referenced by datetime_get_year(), and datetime_set_year().

int datetime_get_day ( const DateTime *  dt,
int day 
)

returns 0 on success or negative value on error

Parameters
dt
day
Returns
int

Definition at line 325 of file values.c.

References datetime_check_day(), and stat.

Referenced by datetime_format().

int datetime_get_fracsec ( const DateTime *  dt,
int fracsec 
)

returns 0 on success or negative value on error

Parameters
dt
fracsec
Returns
int

Definition at line 508 of file values.c.

References datetime_check_fracsec(), and stat.

Referenced by datetime_format().

int datetime_get_hour ( const DateTime *  dt,
int hour 
)

returns 0 on success or negative value on error

Parameters
dt
hour
Returns
int

Definition at line 376 of file values.c.

References datetime_check_hour(), and stat.

Referenced by datetime_format().

int datetime_get_minute ( const DateTime *  dt,
int minute 
)

returns 0 on success or negative value on error

Parameters
dt
minute
Returns
int

Definition at line 420 of file values.c.

References datetime_check_minute(), and stat.

Referenced by datetime_format().

int datetime_get_month ( const DateTime *  dt,
int month 
)

returns 0 on success or negative value on error

Parameters
dt
month
Returns
int

Definition at line 276 of file values.c.

References datetime_check_month(), and stat.

Referenced by datetime_check_day(), and datetime_format().

int datetime_get_second ( const DateTime *  dt,
double *  second 
)

returns 0 on success or negative value on error

Parameters
dt
second
Returns
int

Definition at line 464 of file values.c.

References datetime_check_second(), and stat.

Referenced by datetime_format().

int datetime_get_year ( const DateTime *  dt,
int year 
)

returns 0 on success or negative value on error

Parameters
dt
year
Returns
int

Definition at line 227 of file values.c.

References datetime_check_year(), and stat.

Referenced by datetime_check_day(), and datetime_format().

int datetime_set_day ( DateTime *  dt,
int  day 
)

if dt.mode = ABSOLUTE, then the dt.year, dt.month:

if (day > <b>datetime_days_in_month</b> (dt.year, dt.month))

This implies that year/month must be set for ABSOLUTE datetimes.

Returns 0 on success or negative value on error

Parameters
dt
day
Returns
int

Definition at line 354 of file values.c.

References datetime_check_day(), and stat.

Referenced by datetime_get_local_time(), and datetime_get_local_timezone().

int datetime_set_fracsec ( DateTime *  dt,
int  fracsec 
)

returns 0 on success or negative value on error

Parameters
dt
fracsec
Returns
int

Definition at line 530 of file values.c.

References datetime_check_fracsec(), and stat.

int datetime_set_hour ( DateTime *  dt,
int  hour 
)

returns 0 on success or negative value on error

Parameters
dt
hour
Returns
int

Definition at line 398 of file values.c.

References datetime_check_hour(), and stat.

Referenced by datetime_get_local_time(), and datetime_get_local_timezone().

int datetime_set_minute ( DateTime *  dt,
int  minute 
)

returns 0 on success or negative value on error

Parameters
dt
minute
Returns
int

Definition at line 442 of file values.c.

References datetime_check_minute(), and stat.

Referenced by datetime_change_timezone(), datetime_get_local_time(), and datetime_get_local_timezone().

int datetime_set_month ( DateTime *  dt,
int  month 
)

if dt.mode = ABSOLUTE, this also sets dt.day = 0

returns 0 on success or negative value on error

Parameters
dt
month
Returns
int

Definition at line 300 of file values.c.

References datetime_check_month(), datetime_is_absolute(), and stat.

Referenced by datetime_get_local_time(), and datetime_get_local_timezone().

int datetime_set_second ( DateTime *  dt,
double  second 
)

returns 0 on success or negative value on error

Parameters
dt
second
Returns
int

Definition at line 486 of file values.c.

References datetime_check_second(), and stat.

Referenced by datetime_get_local_time(), and datetime_get_local_timezone().

int datetime_set_year ( DateTime *  dt,
int  year 
)

if dt.mode = ABSOLUTE, this also sets dt.day = 0

returns 0 on success or negative value on error

Parameters
dt
year
Returns
int

Definition at line 251 of file values.c.

References datetime_check_year(), datetime_is_absolute(), and stat.

Referenced by datetime_get_local_time(), and datetime_get_local_timezone().