GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 datetime_change_from_to(), datetime_change_to_utc(), datetime_copy(), datetime_error(), datetime_get_timezone(), datetime_in_interval_year_month(), datetime_increment(), datetime_invert_sign(), datetime_set_increment_type(), and datetime_set_type().

Referenced by datetime_get_local_timezone().