changed: Date::SerializeDay outputs the date in a form of YYYY-MM-DD (before was: YYYY.MM.DD)

git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@411 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2012-05-13 21:49:06 +00:00
parent 5d9ce6e093
commit e25bc826e7
10 changed files with 31 additions and 23 deletions

View File

@ -6,7 +6,7 @@ CXX = g++
endif
ifndef CXXFLAGS
CXXFLAGS = -Wall -pedantic -O2 -I/usr/local/include -I.. -L/usr/local/lib
CXXFLAGS = -Wall -O2 -I/usr/local/include -I.. -L/usr/local/lib
endif
export CXX

View File

@ -207,25 +207,32 @@ public:
/*
this method produces: year.month.day, eg. 1990.02.12
this method outputs to the given stream: YYYY-MM-DD, eg. 1990.02.12
ISO 8601 format
*/
template<class Stream>
void SerializeDay(Stream & out) const;
/*
this method produces: hour:min:sec, eg: 13:05:39
this method outputs to the given stream: HH:MM:SS, eg: 13:05:39
ISO 8601 format
*/
template<class Stream>
void SerializeHour(Stream & out) const;
/*
this method produces: year.month.day our:min:sec, eg: 1990.02.12 13:05:39
this method outputs to the given stream: YYYY-MM-DD HH:MM:SS, eg: 1990-02-12 13:05:39
ISO 8601 format
*/
template<class Stream>
void Serialize(Stream & out) const;
/*
the date
*/
int year; // 1970 - ...
int month; // 1 - 12
int day; // 1 - 31
@ -259,9 +266,10 @@ void Date::SerializeInt(Stream & out, int val) const
template<class Stream>
void Date::SerializeDay(Stream & out) const
{
out << year << '.';
// !! IMPROVE ME the year should be printed with 4 digits, e.g. 0001 when the year is equal to one
out << year << '-';
SerializeInt(out, month);
out << '.';
out << '-';
SerializeInt(out, day);
}