1 | #include "gregorian.hpp" |
---|
2 | |
---|
3 | namespace xios |
---|
4 | { |
---|
5 | /// ////////////////////// Définitions ////////////////////// /// |
---|
6 | |
---|
7 | CGregorianCalendar::CGregorianCalendar(const StdString & dateStr) |
---|
8 | : CCalendar("Gregorian") |
---|
9 | { initializeDate(dateStr); } |
---|
10 | |
---|
11 | CGregorianCalendar::CGregorianCalendar(const StdString & dateStr,const StdString & timeOriginStr) |
---|
12 | : CCalendar("Gregorian") |
---|
13 | { initializeDate(dateStr, timeOriginStr); } |
---|
14 | |
---|
15 | CGregorianCalendar::CGregorianCalendar(int yr, int mth, int d, |
---|
16 | int hr, int min, int sec) |
---|
17 | : CCalendar("Gregorian") |
---|
18 | { initializeDate(yr, mth, d, hr, min, sec) ; } |
---|
19 | |
---|
20 | CGregorianCalendar::~CGregorianCalendar(void) |
---|
21 | { /* Ne rien faire de plus */ } |
---|
22 | |
---|
23 | ///-------------------------------------------------------------- |
---|
24 | |
---|
25 | int CGregorianCalendar::getYearTotalLength(const CDate & date) const |
---|
26 | { // Retourne la durée d'une année en seconde. |
---|
27 | if ((date.getYear() % 4 == 0) && |
---|
28 | ((date.getYear() % 100 != 0) || |
---|
29 | (date.getYear() % 400 == 0) )) |
---|
30 | return (366 * 86400); |
---|
31 | return (365 * 86400); |
---|
32 | } |
---|
33 | |
---|
34 | int CGregorianCalendar::getMonthLength(const CDate & date) const |
---|
35 | { // Retourne la durée du mois en jour. |
---|
36 | if (date.getMonth() == 2) |
---|
37 | { // Traitement du cas particulier en Février. |
---|
38 | if ((date.getYear() % 4 == 0) && |
---|
39 | ((date.getYear() % 100 != 0) || |
---|
40 | (date.getYear() % 400 == 0) )) |
---|
41 | return (29); |
---|
42 | return (28); |
---|
43 | } |
---|
44 | return (CCalendar::getMonthLength(date)); |
---|
45 | } |
---|
46 | |
---|
47 | StdString CGregorianCalendar::getType(void) const |
---|
48 | { return (StdString("gregorian")); } |
---|
49 | |
---|
50 | ///-------------------------------------------------------------- |
---|
51 | } // namespace xmlioserver |
---|
52 | |
---|