GRASS GIS 7 Programmer's Manual  7.5.svn(2017)-r71785
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
datetime/type.c File Reference
#include <grass/datetime.h>
Include dependency graph for datetime/type.c:

Go to the source code of this file.

Functions

int datetime_set_type (DateTime *dt, int mode, int from, int to, int fracsec)
 
int datetime_get_type (const DateTime *dt, int *mode, int *from, int *to, int *fracsec)
 
int datetime_is_valid_type (const DateTime *dt)
 Returns: 1 if datetime_check_type() returns 0 0 if not. More...
 
int datetime_check_type (const DateTime *dt)
 checks the mode/from/to/fracsec in dt. Returns: More...
 
int datetime_in_interval_year_month (int x)
 
int datetime_in_interval_day_second (int x)
 
int datetime_is_absolute (const DateTime *dt)
 Returns: 1 if dt.mode is absolute 0 if not (even if dt.mode is not defined) More...
 
int datetime_is_relative (const DateTime *dt)
 Returns: 1 if dt.mode is relative 0 if not (even if dt.mode is not defined) More...
 

Function Documentation

int datetime_check_type ( const DateTime dt)

checks the mode/from/to/fracsec in dt. Returns:

  • 0: OK
  • -1: mode is invalid - not one of {ABSOLUTE,RELATIVE}
  • -2: from is invalid - not one of {YEAR,MONTH,DAY,HOUR,MINUTE,SECOND}
  • -3: to is invalid - not one of {YEAR,MONTH,DAY,HOUR,MINUTE,SECOND}
  • -4: from/to are reversed (from>to is illegal)
  • -5: invalid from/to combination for RELATIVE mode: from in {YEAR,MONTH} but to is not, or from in {DAY,HOUR,MINUTE,SECOND} but to is not
  • -6: from is invalid for ABSOLUTE mode (from != YEAR is illegal)
  • -7: fracsec is negative (only if to==SECOND)
Parameters
dt
Returns
int

Definition at line 116 of file datetime/type.c.

References DATETIME_ABSOLUTE, datetime_error(), datetime_in_interval_day_second(), datetime_in_interval_year_month(), datetime_is_between(), DATETIME_RELATIVE, DATETIME_SECOND, DATETIME_YEAR, DateTime::fracsec, DateTime::from, DateTime::mode, and DateTime::to.

Referenced by datetime_get_type(), datetime_is_valid_type(), and datetime_set_type().

int datetime_get_type ( const DateTime dt,
int mode,
int from,
int to,
int fracsec 
)
int datetime_in_interval_day_second ( int  x)
int datetime_in_interval_year_month ( int  x)
int datetime_is_absolute ( const DateTime dt)

Returns: 1 if dt.mode is absolute 0 if not (even if dt.mode is not defined)

Parameters
dt
Returns
int

Definition at line 173 of file datetime/type.c.

References DATETIME_ABSOLUTE, and DateTime::mode.

Referenced by datetime_change_from_to(), datetime_check_day(), datetime_check_month(), datetime_check_timezone(), datetime_check_year(), datetime_format(), datetime_get_increment_type(), datetime_set_month(), and datetime_set_year().

int datetime_is_relative ( const DateTime dt)

Returns: 1 if dt.mode is relative 0 if not (even if dt.mode is not defined)

Parameters
dt
Returns
int

Definition at line 190 of file datetime/type.c.

References DATETIME_RELATIVE, and DateTime::mode.

Referenced by datetime_check_increment(), datetime_check_month(), and datetime_format().

int datetime_is_valid_type ( const DateTime dt)

Returns: 1 if datetime_check_type() returns 0 0 if not.

Parameters
dt
Returns
int

Definition at line 80 of file datetime/type.c.

References datetime_check_type().

Referenced by datetime_change_from_to(), datetime_check_increment(), datetime_format(), and datetime_get_increment_type().

int datetime_set_type ( DateTime dt,
int  mode,
int  from,
int  to,
int  fracsec 
)
  • This routine must be called can be made with other datetime functions.
  • initialize all the elements in dt.
  • Set all values to zero except: tz (set to illegal value - 99*24) positive (set to 1 for positive)
  • Set the type info in dt: mode, from, to, fracsec
  • validate the mode/from/to/fracsec (according to the rules for the mode)
  • return the return value from datetime_check_type(dt)
Parameters
mode
from
to
fracsec
Returns
int

Definition at line 37 of file datetime/type.c.

References datetime_check_type(), datetime_unset_timezone(), DateTime::day, DateTime::fracsec, DateTime::from, DateTime::hour, DateTime::minute, DateTime::mode, DateTime::month, DateTime::positive, DateTime::second, DateTime::to, and DateTime::year.

Referenced by datetime_change_from_to(), datetime_change_timezone(), datetime_difference(), datetime_get_local_time(), datetime_get_local_timezone(), and datetime_set_increment_type().