wibble
0.1.28
|
00001 // -*- C++ -*- 00002 #ifndef WIBBLE_GRCAL_GRCAL_H 00003 #define WIBBLE_GRCAL_GRCAL_H 00004 00005 /* 00006 * Gregorian calendar functions 00007 * 00008 * Copyright (C) 2007--2008 Enrico Zini <enrico@debian.org> 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with this library; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 */ 00024 00025 #include <string> 00026 00067 struct tm; 00068 00069 namespace wibble { 00070 namespace grcal { 00071 00075 namespace date { 00076 00080 void today(int* dst); 00081 00083 void now(int* dst); 00084 00086 int daysinmonth(int year, int month); 00087 00089 int daysinyear(int year); 00090 00097 void easter(int year, int* month, int* day); 00098 00103 void lowerbound(const int* src, int* dst); 00104 00109 void lowerbound(int* val); 00110 00115 void upperbound(const int* src, int* dst); 00116 00121 void upperbound(int* val); 00122 00142 void normalise(int* res); 00143 00151 long long int secondsfrom(int year, const int* val); 00152 00158 long long int duration(const int* begin, const int* end); 00159 00165 void mergetime(const int* date, const int* time, int* dst); 00166 00172 void mergetime(int* date, const int* time); 00173 00177 void totm(const int* src, struct tm* dst); 00178 00183 void fromtm(const struct tm& src, int* dst, int count = 6); 00184 00188 std::string tostring(const int* val); 00189 00190 } 00191 00195 namespace dtime { 00196 00201 void lowerbound(const int* src, int* dst); 00202 00207 void lowerbound(int* val); 00208 00213 int lowerbound_sec(const int* src); 00214 00215 00220 void upperbound(const int* src, int* dst); 00221 00226 void upperbound(int* val); 00227 00232 int upperbound_sec(const int* src); 00233 00240 int duration(const int* begin, const int* end); 00241 00245 std::string tostring(const int* val); 00246 00250 std::string tostring(int val); 00251 00252 } 00253 00254 } 00255 } 00256 00257 // vim:set ts=4 sw=4: 00258 #endif