source: XIOS/branchs/xios-1.0/src/date.hpp @ 573

Last change on this file since 573 was 544, checked in by rlacroix, 9 years ago

Fix: The conversion of a date to a number of seconds since the time origin was wrong.

Remove the work around in nc4_data_output.cpp which hid this bug.

Also backport this fix in XIOS 1.0.

  • 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: 2.3 KB
Line 
1#ifndef __XMLIO_CDate__
2#define __XMLIO_CDate__
3
4/// xios headers ///
5#include "xmlioserver_spl.hpp"
6#include "exception.hpp"
7#include "duration.hpp"
8
9namespace xios
10{
11      /// ////////////////////// Déclarations ////////////////////// ///
12      class CCalendar;
13
14      class CDate
15      {
16         public :
17
18            /// Constructeurs ///
19            CDate(void);                      // Not implemented yet
20            CDate(const CCalendar & cal);
21            CDate(const CCalendar & cal,int yr, int mth, int d,
22                                        int hr = 0, int min = 0, int sec = 0);
23            CDate(const CDate & odate);
24            CDate(const CDate * const odate); // Not implemented yet
25
26            /// Destructeur ///
27            ~CDate(void);
28
29            /// Opérateurs ///
30            CDate & operator=(const CDate & date);
31            friend StdOStream & operator<<(StdOStream & out, const CDate & date);
32            friend StdIStream & operator>>(StdIStream & in, CDate & date); // Non testée.
33
34            //!< Return the number of seconds since the time origin fixed when creating the calendar
35            operator Time(void) const;
36
37            /// Traitements ///
38            bool checkDate(void); // Vérifie la validité de la date.
39
40            /// Divers accesseurs ///
41            int getYear  (void) const;
42            int getMonth (void) const;
43            int getDay   (void) const;
44            int getHour  (void) const;
45            int getMinute(void) const;
46            int getSecond(void) const;
47
48            const CCalendar & getRelCalendar(void) const;
49
50            /// Mutateurs ///
51            void setYear  (int newyear);
52            void setMonth (int newmonth);
53            void setDay (int newday);
54
55            void addMonth (int value);
56
57            /// Autres ///
58            StdString toString(void) const;
59            StdString getStryyyymmdd(void) const;
60            string getStr(const string& str) const;
61
62
63         public : /* static */
64
65            static CDate FromString(const StdString & str, const CCalendar & calendar);
66
67         private :
68
69            /// Propriétés privées ///
70            const CCalendar & relCalendar; // Calendrier lié à la Date.
71            int year, month, day, hour, minute, second; // Année, mois, ...
72
73
74      }; // class CDate;
75
76} // namespace xios
77
78#endif // __XMLIO_CDate__
Note: See TracBrowser for help on using the repository browser.