grcal.h
Go to the documentation of this file.
// -*- C++ -*-
#ifndef WIBBLE_GRCAL_GRCAL_H
#define WIBBLE_GRCAL_GRCAL_H
/*
* Gregorian calendar functions
*
* Copyright (C) 2007--2008 Enrico Zini <enrico@debian.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string>
struct tm;
namespace wibble {
namespace grcal {
namespace date {
void today(int* dst);
void now(int* dst);
int daysinmonth(int year, int month);
int daysinyear(int year);
void easter(int year, int* month, int* day);
void lowerbound(const int* src, int* dst);
void lowerbound(int* val);
void upperbound(const int* src, int* dst);
void upperbound(int* val);
void normalise(int* res);
long long int secondsfrom(int year, const int* val);
long long int duration(const int* begin, const int* end);
void mergetime(const int* date, const int* time, int* dst);
void mergetime(int* date, const int* time);
void totm(const int* src, struct tm* dst);
void fromtm(const struct tm& src, int* dst, int count = 6);
std::string tostring(const int* val);
}
namespace dtime {
void lowerbound(const int* src, int* dst);
void lowerbound(int* val);
int lowerbound_sec(const int* src);
void upperbound(const int* src, int* dst);
void upperbound(int* val);
int upperbound_sec(const int* src);
int duration(const int* begin, const int* end);
std::string tostring(const int* val);
std::string tostring(int val);
}
}
}
// vim:set ts=4 sw=4:
#endif
wibble::grcal::date::duration
long long int duration(const int *begin, const int *end)
Give the duration in seconds of the interval between begin and end.
Definition: grcal.cpp:245
wibble::grcal::date::mergetime
void mergetime(const int *date, const int *time, int *dst)
Make a copy of date, with the time part taken from time.
Definition: grcal.cpp:264
wibble::grcal::date::secondsfrom
long long int secondsfrom(int year, const int *val)
Convert the given time in seconds elapsed since the beginning of the given year.
Definition: grcal.cpp:229
wibble::grcal::dtime::upperbound_sec
int upperbound_sec(const int *src)
Convert a time of day in second, filling the missing values with the highest possible value they can ...
Definition: grcal.cpp:377
wibble::grcal::date::fromtm
void fromtm(const struct tm &src, int *dst, int count)
Copy the values from a struct tm to the first count values of the int[6] dst.
Definition: grcal.cpp:291
wibble::grcal::date::totm
void totm(const int *src, struct tm *dst)
Copy the values from an int[6] datetime into a struct tm.
Definition: grcal.cpp:281
wibble::grcal::date::now
void now(int *dst)
Fill in an int[6] with the UTC values for now.
wibble::list::begin
ListIterator< List > begin(List l)
Definition: list.h:420
wibble::grcal::date::today
void today(int *dst)
Fill in an int[6] with the UTC values for today (leaving the time of day elements to -1) ...
wibble::grcal::date::upperbound
void upperbound(const int *src, int *dst)
Make a copy of the datetime, filling in missing values with the highest possible value they can have...
Definition: grcal.cpp:191
wibble::list::count
size_t count(List l)
Definition: list.h:341
wibble::grcal::date::easter
void easter(int year, int *month, int *day)
Compute the day of Easter.
Definition: grcal.cpp:91
wibble::grcal::dtime::lowerbound_sec
int lowerbound_sec(const int *src)
Convert a time of day in second, filling the missing values with the lowest possible value they can h...
Definition: grcal.cpp:353
wibble::grcal::date::tostring
std::string tostring(const int *val)
Convert a datetime to a string.
Definition: grcal.cpp:319
wibble::grcal::date::normalise
void normalise(int *res)
Normalise a datetime, in place.
Definition: grcal.cpp:145
wibble::grcal::date::lowerbound
void lowerbound(const int *src, int *dst)
Make a copy of the datetime, filling in missing values with the lowest possible value they can have...
Definition: grcal.cpp:112
wibble
Definition: amorph.h:17
wibble::grcal::date::daysinmonth
int daysinmonth(int year, int month)
Return the number of days in a month.
Definition: grcal.cpp:57
wibble::grcal::date::daysinyear
int daysinyear(int year)
Return the number of days in a year.
Definition: grcal.cpp:84
wibble::list::end
ListIterator< List > end(List)
Definition: list.h:425