Loading...
Searching...
No Matches
type.c File Reference
`#include <grass/datetime.h>`
Include dependency graph for 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.
int | datetime_check_type (const DateTime *dt)
| checks the mode/from/to/fracsec in dt. Returns:
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).
int | datetime_is_relative (const DateTime *dt)
| Returns: 1 if dt.mode is relative 0 if not (even if dt.mode is not defined).

## Function Documentation

## datetime_check_type()

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 110 of file type.c.

References datetime_error(), datetime_in_interval_day_second(), datetime_in_interval_year_month(), and datetime_is_between().

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

## datetime_get_type()

int datetime_get_type | ( | const DateTime * | dt,
|  | int * | mode,
|  | int * | from,
|  | int * | to,
|  | int * | fracsec )

Definition at line 56 of file type.c.

References datetime_check_type().

## datetime_in_interval_day_second()

int datetime_in_interval_day_second | ( | int | x | ) |

Definition at line 150 of file type.c.

References datetime_is_between(), and x.

Referenced by datetime_check_increment(), datetime_check_type(), and datetime_increment().

## datetime_in_interval_year_month()

int datetime_in_interval_year_month | ( | int | x | ) |

Definition at line 145 of file type.c.

References datetime_is_between(), and x.

Referenced by datetime_check_increment(), datetime_check_type(), datetime_difference(), and datetime_get_increment_type().

## datetime_is_absolute()

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 165 of file type.c.

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().

## datetime_is_relative()

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 180 of file type.c.

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

## datetime_is_valid_type()

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 76 of file type.c.

References datetime_check_type().

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

## datetime_set_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

  dt |
  mode |
  from |
  to |
  fracsec |

Returns
  int

Definition at line 36 of file type.c.

References datetime_check_type(), and datetime_unset_timezone().

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