wibble  1.1
grcal.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 #ifndef WIBBLE_GRCAL_GRCAL_H
3 #define WIBBLE_GRCAL_GRCAL_H
4 
5 /*
6  * Gregorian calendar functions
7  *
8  * Copyright (C) 2007--2008 Enrico Zini <enrico@debian.org>
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23  */
24 
25 #include <string>
26 
67 struct tm;
68 
69 namespace wibble {
70 namespace grcal {
71 
75 namespace date {
76 
80 void today(int* dst);
81 
83 void now(int* dst);
84 
86 int daysinmonth(int year, int month);
87 
89 int daysinyear(int year);
90 
97 void easter(int year, int* month, int* day);
98 
103 void lowerbound(const int* src, int* dst);
104 
109 void lowerbound(int* val);
110 
115 void upperbound(const int* src, int* dst);
116 
121 void upperbound(int* val);
122 
142 void normalise(int* res);
143 
151 long long int secondsfrom(int year, const int* val);
152 
158 long long int duration(const int* begin, const int* end);
159 
165 void mergetime(const int* date, const int* time, int* dst);
166 
172 void mergetime(int* date, const int* time);
173 
177 void totm(const int* src, struct tm* dst);
178 
183 void fromtm(const struct tm& src, int* dst, int count = 6);
184 
188 std::string tostring(const int* val);
189 
190 }
191 
195 namespace dtime {
196 
201 void lowerbound(const int* src, int* dst);
202 
207 void lowerbound(int* val);
208 
213 int lowerbound_sec(const int* src);
214 
215 
220 void upperbound(const int* src, int* dst);
221 
226 void upperbound(int* val);
227 
232 int upperbound_sec(const int* src);
233 
240 int duration(const int* begin, const int* end);
241 
245 std::string tostring(const int* val);
246 
250 std::string tostring(int val);
251 
252 }
253 
254 }
255 }
256 
257 // vim:set ts=4 sw=4:
258 #endif