GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-57a646b4a4
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 More...
 
int datetime_change_to_utc (DateTime *dt)
 Return datetime_change_timezone (dt, 0);. More...
 
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) More...
 

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 21 of file tz2.c.

References datetime_error(), datetime_get_timezone(), datetime_increment(), datetime_invert_sign(), datetime_is_valid_timezone(), DATETIME_MINUTE, DATETIME_RELATIVE, 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 59 of file tz2.c.

References datetime_change_timezone().

◆ 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 82 of file tz2.c.