GRASS Programmer's Manual
6.4.3(2013)-r
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Macros
Pages
tz1.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
10
static
int
have(
int
x,
const
DateTime * dt)
11
{
12
return
datetime_is_between
(x, dt->from, dt->to);
13
}
14
15
26
int
datetime_check_timezone
(
const
DateTime * dt,
int
minutes)
27
{
28
if
(!
datetime_is_absolute
(dt))
29
return
datetime_error
(-1,
"datetime not absolute"
);
30
if
(!have(DATETIME_MINUTE, dt))
31
return
datetime_error
(-2,
"datetime has no minute"
);
32
if
(!
datetime_is_valid_timezone
(minutes))
33
return
datetime_error
(-3,
"invalid datetime timezone"
);
34
35
return
0;
36
}
37
38
49
int
datetime_get_timezone
(
const
DateTime * dt,
int
*minutes)
50
{
51
int
stat;
52
53
stat =
datetime_check_timezone
(dt, dt->tz);
54
if
(stat == 0)
55
*minutes = dt->tz;
56
57
return
stat;
58
}
59
60
71
int
datetime_set_timezone
(DateTime * dt,
int
minutes)
72
{
73
int
stat;
74
75
stat =
datetime_check_timezone
(dt, minutes);
76
if
(stat == 0)
77
dt->tz = minutes;
78
79
return
stat;
80
}
81
92
int
datetime_unset_timezone
(DateTime * dt)
93
{
94
dt->tz = -9999;
95
96
return
0;
97
}
98
99
111
int
datetime_is_valid_timezone
(
int
minutes)
112
{
113
return
(minutes >= -720 && minutes <= 780);
114
}
lib
datetime
tz1.c
Generated on Thu Sep 26 2013 09:48:07 for GRASS Programmer's Manual by
1.8.4