Loading...
Searching...
No Matches
tz2.c File Reference
`#include <grass/datetime.h>`
Include dependency graph for tz2.c:

Go to the source code of this file.

## Functions

int | datetime_change_timezone (DateTime *dt, int minutes)
| if dt has a timezone, increment dt by minutes-dt.tz MINUTES and set dt.tz = minutes Returns: 0 OK datetime_check_timezone (dt) if not -4 if minutes invalid
int | datetime_change_to_utc (DateTime *dt)
| Return datetime_change_timezone (dt, 0);.
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 tz itself to see if the tz is negative offset or not. This routine would be used to format tz for output. For example if tz=-350 this would be hour=5 minute=50, but negative. Output might encode this as -0550: printf ("%s%02d%02d", tz<0?"-":"", hour, minute)

## Function Documentation

## datetime_change_timezone()

int datetime_change_timezone | ( | DateTime * | dt,
|  | int | minutes )

if dt has a timezone, increment dt by minutes-dt.tz MINUTES and set dt.tz = minutes Returns: 0 OK datetime_check_timezone (dt) if not -4 if minutes invalid

Parameters

  dt |
  minutes |

Returns
  int

Definition at line 20 of file tz2.c.

References datetime_error(), datetime_get_timezone(), datetime_increment(), datetime_invert_sign(), datetime_is_valid_timezone(), datetime_set_minute(), and datetime_set_type().

Referenced by datetime_change_to_utc().

## datetime_change_to_utc()

int datetime_change_to_utc | ( | DateTime * | dt | ) |

Return datetime_change_timezone (dt, 0);.

Parameters

  dt |

Returns
  int

Definition at line 57 of file tz2.c.

References datetime_change_timezone().

Referenced by datetime_difference().

## datetime_decompose_timezone()

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 tz itself to see if the tz is negative offset or not. This routine would be used to format tz for output. For example if tz=-350 this would be hour=5 minute=50, but negative. Output might encode this as -0550: printf ("%s%02d%02d", tz<0?"-":"", hour, minute)

Parameters

  tz |
  hours |
  minutes |

Returns
  void

Definition at line 79 of file tz2.c.

Referenced by datetime_format().