source: XIOS/trunk/src/date/gregorian.cpp @ 501

Last change on this file since 501 was 501, checked in by ymipsl, 9 years ago

Add licence copyright to all file ond directory src using the command :
svn propset -R copyright -F header_licence src

XIOS is now officialy under CeCILL licence

YM

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 1.8 KB
Line 
1#include "gregorian.hpp"
2
3namespace 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
Note: See TracBrowser for help on using the repository browser.