GRASS GIS 7 Programmer's Manual
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.


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 == SECOND, then result.fracsec is a.fracsec
  • result will have the following from/to based on result 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.

Definition at line 81 of file diff.c.

Referenced by datetime_get_local_timezone().