GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-602118adcc
diff.c File Reference
#include <stdlib.h>
#include <grass/datetime.h>
#include "math.h"
Include dependency graph for diff.c:

Go to the source code of this file.

Functions

int datetime_difference (const DateTime *a, const DateTime *b, DateTime *result)
 This performs the formula: result = a - b;. More...
 

Function Documentation

◆ datetime_difference()

int datetime_difference ( const DateTime a,
const DateTime b,
DateTime result 
)

This performs the formula: result = a - b;.

  • both a and b must be absolute.
  • result will be relative
  • If a is "earlier" than b, then result will be set negative.
  • b must be no more "precise" than a. (a copy of b is "extended" to the precision of a)
  • If result.to == SECOND, then result.fracsec is a.fracsec
  • result will have the following from/to based on a.to: result a.to from to YEAR YEAR YEAR MONTH YEAR MONTH DAY DAY DAY HOUR DAY HOUR MINUTE DAY MINUTE SECOND DAY SECOND [LAYOUT ??? - see HTML]
  • If either 'a' or 'b' has a timezone, both must have a timezone. The difference will account for the differences in the time zones.
Parameters
a
b
result
Returns
int

Definition at line 79 of file diff.c.

Referenced by datetime_get_local_timezone().