GRASS Programmer's Manual
6.4.2(2012)
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
incr2.c
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1995. Bill Brown <brown@gis.uiuc.edu> & Michael Shapiro
3
*
4
* This program is free software under the GPL (>=v2)
5
* Read the file GPL.TXT coming with GRASS for details.
6
*/
7
#include <grass/datetime.h>
8
9
21
int
datetime_is_valid_increment
(
const
DateTime * src,
const
DateTime * incr)
22
{
23
return
datetime_check_increment
(src, incr) == 0;
24
}
25
26
27
60
int
datetime_check_increment
(
const
DateTime * src,
const
DateTime * incr)
61
{
62
if
(!
datetime_is_valid_type
(src))
63
return
1;
64
if
(!
datetime_is_valid_type
(incr))
65
return
2;
66
67
if
(!
datetime_is_relative
(incr))
68
return
datetime_error
(-1,
"datetime increment mode not relative"
);
69
if
(incr->to > src->to)
70
return
datetime_error
(-2,
"datetime increment too precise"
);
71
72
if
(
datetime_in_interval_year_month
(src->to) &&
73
!
datetime_in_interval_year_month
(incr->to))
74
return
datetime_error
(-3,
"illegal datetime increment interval"
);
75
76
if
(
datetime_in_interval_day_second
(src->to) &&
77
!
datetime_in_interval_day_second
(incr->to))
78
return
datetime_error
(-4,
"illegal datetime increment interval"
);
79
80
return
0;
81
}
lib
datetime
incr2.c
Generated on Sun Mar 16 2014 05:07:46 for GRASS Programmer's Manual by
1.8.1.2