GRASS GIS 7 Programmer's Manual  7.7.svn(2018)-r73380
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

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 81 of file diff.c.

References compare(), datetime_change_from_to(), datetime_change_to_utc(), datetime_copy(), DATETIME_DAY, datetime_error(), datetime_get_timezone(), datetime_in_interval_year_month(), datetime_increment(), datetime_invert_sign(), DATETIME_RELATIVE, datetime_set_increment_type(), datetime_set_type(), DATETIME_YEAR, DateTime::day, DateTime::fracsec, DateTime::hour, DateTime::minute, DateTime::month, DateTime::positive, DateTime::second, DateTime::to, and DateTime::year.

Referenced by datetime_get_local_timezone().