Loading...
Searching...
No Matches
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.
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.
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.
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
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
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
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
int | datetime_get_year (const DateTime *dt, int *year)
| returns 0 on success or negative value on error
int | datetime_set_year (DateTime *dt, int year)
| if dt.mode = ABSOLUTE, this also sets dt.day = 0
int | datetime_get_month (const DateTime *dt, int *month)
| returns 0 on success or negative value on error
int | datetime_set_month (DateTime *dt, int month)
| if dt.mode = ABSOLUTE, this also sets dt.day = 0
int | datetime_get_day (const DateTime *dt, int *day)
| returns 0 on success or negative value on error
int | datetime_set_day (DateTime *dt, int day)
| if dt.mode = ABSOLUTE, then the dt.year, dt.month:
int | datetime_get_hour (const DateTime *dt, int *hour)
| returns 0 on success or negative value on error
int | datetime_set_hour (DateTime *dt, int hour)
| returns 0 on success or negative value on error
int | datetime_get_minute (const DateTime *dt, int *minute)
| returns 0 on success or negative value on error
int | datetime_set_minute (DateTime *dt, int minute)
| 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_set_second (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_set_fracsec (DateTime *dt, int fracsec)
| returns 0 on success or negative value on error

## Function Documentation

## datetime_check_day()

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 84 of file values.c.

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

Referenced by datetime_get_day(), and datetime_set_day().

## datetime_check_fracsec()

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 192 of file values.c.

References datetime_error().

Referenced by datetime_get_fracsec(), and datetime_set_fracsec().

## datetime_check_hour()

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 120 of file values.c.

References datetime_error().

Referenced by datetime_get_hour(), and datetime_set_hour().

## datetime_check_minute()

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 144 of file values.c.

References datetime_error().

Referenced by datetime_get_minute(), and datetime_set_minute().

## datetime_check_month()

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 50 of file values.c.

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

Referenced by datetime_get_month(), and datetime_set_month().

## datetime_check_second()

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 168 of file values.c.

References datetime_error().

Referenced by datetime_get_second(), and datetime_set_second().

## datetime_check_year()

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 26 of file values.c.

References datetime_error(), and datetime_is_absolute().

Referenced by datetime_get_year(), and datetime_set_year().

## datetime_get_day()

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 300 of file values.c.

References datetime_check_day().

Referenced by datetime_format().

## datetime_get_fracsec()

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 467 of file values.c.

References datetime_check_fracsec().

Referenced by datetime_format().

## datetime_get_hour()

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 347 of file values.c.

References datetime_check_hour().

Referenced by datetime_format().

## datetime_get_minute()

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 387 of file values.c.

References datetime_check_minute().

Referenced by datetime_format().

## datetime_get_month()

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 255 of file values.c.

References datetime_check_month().

Referenced by datetime_check_day(), and datetime_format().

## datetime_get_second()

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 427 of file values.c.

References datetime_check_second().

Referenced by datetime_format().

## datetime_get_year()

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 210 of file values.c.

References datetime_check_year().

Referenced by datetime_check_day(), and datetime_format().

## datetime_set_day()

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))
{error}
b
double b
Definition driver/set_window.c:5
datetime_days_in_month
int datetime_days_in_month(int year, int month, int ad)
returns number of days in 'month' of a particular 'year'
Definition misc.c:58

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 327 of file values.c.

References datetime_check_day().

Referenced by datetime_get_local_time(), and datetime_get_local_timezone().

## datetime_set_fracsec()

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 487 of file values.c.

References datetime_check_fracsec().

## datetime_set_hour()

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 367 of file values.c.

References datetime_check_hour().

Referenced by datetime_get_local_time(), and datetime_get_local_timezone().

## datetime_set_minute()

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 407 of file values.c.

References datetime_check_minute().

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

## datetime_set_month()

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 277 of file values.c.

References datetime_check_month(), and datetime_is_absolute().

Referenced by datetime_get_local_time(), and datetime_get_local_timezone().

## datetime_set_second()

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 447 of file values.c.

References datetime_check_second().

Referenced by datetime_get_local_time(), and datetime_get_local_timezone().

## datetime_set_year()

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 232 of file values.c.

References datetime_check_year(), and datetime_is_absolute().

Referenced by datetime_get_local_time(), and datetime_get_local_timezone().