bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
DODS_Date_Time.h
1
2// -*- mode: c++; c-basic-offset:4 -*-
3
4// This file is part of ff_handler a FreeForm API handler for the OPeNDAP
5// DAP2 data server.
6
7// Copyright (c) 2005 OPeNDAP, Inc.
8// Author: James Gallagher <jgallagher@opendap.org>
9//
10// This is free software; you can redistribute it and/or modify it under the
11// terms of the GNU Lesser General Public License as published by the Free
12// Software Foundation; either version 2.1 of the License, or (at your
13// option) any later version.
14//
15// This software is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18// License for more details.
19//
20// You should have received a copy of the GNU Lesser General Public
21// License along with this library; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23//
24// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25
26
27// (c) COPYRIGHT URI/MIT 1998
28// Please read the full copyright statement in the file COPYRIGHT.
29//
30// Authors:
31// jhrg,jimg James Gallagher (jgallagher@gso.uri.edu)
32
33#ifndef _dods_date_time_h
34#define _dods_date_time_h
35
36
37#include "DODS_Date.h"
38#include "DODS_Time.h"
39
46
48 private:
49 DODS_Date _date;
50 DODS_Time _time;
51
52 void parse_fractional_time(string date_time);
53 public:
56
58
64
69 DODS_Date_Time(string date_time);
70
75 DODS_Date_Time(BaseType *date_time);
76
86 DODS_Date_Time(int y, int m, int d, int hh, int mm = 0, double ss = 0.0,
87 bool gmt = false);
88
97 DODS_Date_Time(int y, int yd, int hh, int mm = 0, double ss = 0.0,
98 bool gmt = false);
100
103
107 void set(DODS_Date d, DODS_Time t);
108
113 void set(string date_time);
114
119 void set(BaseType *date_time);
120
130 void set(int y, int m, int d, int hh, int mm = 0,
131 double ss = 0.0, bool gmt = false);
132
141 void set(int y, int yd, int hh, int mm = 0, double ss = 0.0,
142 bool gmt = false);
144
147
148 int year() const;
149
151 int month() const;
152
154 int day() const;
155
157 int day_number() const;
158
160 int hours() const;
161
163 int minutes() const;
164
166 double seconds() const;
167
169 bool gmt() const;
170
179 string get(date_format format = ymd, bool gmt = true) const;
180
183 double julian_day() const;
184
194 time_t unix_time() const;
196
199
200 friend int operator==(DODS_Date_Time &t1, DODS_Date_Time &t2);
201
203 friend int operator!=(DODS_Date_Time &t1, DODS_Date_Time &t2);
204
206 friend int operator<(DODS_Date_Time &t1, DODS_Date_Time &t2);
207
209 friend int operator>(DODS_Date_Time &t1, DODS_Date_Time &t2);
210
212 friend int operator<=(DODS_Date_Time &t1, DODS_Date_Time &t2);
213
215 friend int operator>=(DODS_Date_Time &t1, DODS_Date_Time &t2);
217
219 double get_epsilon() const;
220
225 void set_epsilon(double eps);
226
230 bool OK() const;
231
232};
233
234// $Log: DODS_Date_Time.h,v $
235// Revision 1.4 2000/10/11 19:37:55 jimg
236// Moved the CVS log entries to the end of files.
237// Changed the definition of the read method to match the dap library.
238// Added exception handling.
239// Added exceptions to the read methods.
240//
241// Revision 1.3 1999/07/22 21:28:09 jimg
242// Merged changes from the release-3-0-2 branch
243//
244// Revision 1.2.6.1 1999/06/01 15:38:06 jimg
245// Added code to parse and return floating point dates.
246//
247// Revision 1.2 1999/05/04 02:55:35 jimg
248// Merge with no-gnu
249//
250// Revision 1.1.6.1 1999/05/01 04:40:30 brent
251// converted old String.h to the new std C++ <string> code
252//
253// Revision 1.1 1999/01/08 22:08:18 jimg
254// Fixed doc++ comments.
255//
256
257#endif // _dods_date_time_h
bool OK() const
double julian_day() const
int minutes() const
friend int operator>=(DODS_Date_Time &t1, DODS_Date_Time &t2)
Greater-than or Equal-to.
string get(date_format format=ymd, bool gmt=true) const
friend int operator==(DODS_Date_Time &t1, DODS_Date_Time &t2)
Equality.
double get_epsilon() const
int day_number() const
void set_epsilon(double eps)
double seconds() const
void set(DODS_Date d, DODS_Time t)
friend int operator<(DODS_Date_Time &t1, DODS_Date_Time &t2)
Less-than.
int hours() const
int month() const
friend int operator!=(DODS_Date_Time &t1, DODS_Date_Time &t2)
Inequality.
time_t unix_time() const
friend int operator<=(DODS_Date_Time &t1, DODS_Date_Time &t2)
Less-than or Equal-to.
bool gmt() const
friend int operator>(DODS_Date_Time &t1, DODS_Date_Time &t2)
Greater-than.