added: to TextStream<> and Log:

operator<<(const tm & tm_)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@797 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2012-01-19 20:50:42 +00:00
parent 8b64b5d372
commit 4311f06ade
4 changed files with 37 additions and 3 deletions

View File

@@ -11,6 +11,7 @@
#define headerfile_winix_core_textstream
#include <string>
#include <ctime>
#include "misc.h"
#include "confparser/space.h"
@@ -58,7 +59,7 @@ public:
TextStream & operator<<(const void *);// printing a pointer
TextStream & operator<<(const PT::Space * space);
TextStream & operator<<(const PT::Space & space);
TextStream & operator<<(const tm & tm_);
TextStream & Write(const char * buf, size_t len);
TextStream & Write(const wchar_t * buf, size_t len);
@@ -309,10 +310,9 @@ TextStream<StringType> & TextStream<StringType>::write(const wchar_t * buf, size
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(const PT::Space * space)
{
// !! check me pls
space->Serialize(*this, true, false);
return *this;
return *this;
}
@@ -323,6 +323,26 @@ TextStream<StringType> & TextStream<StringType>::operator<<(const PT::Space & sp
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(const tm & tm_)
{
char buf[50];
sprintf(buf, "%04d-%02d-%02d %02d:%02d:%02d",
tm_.tm_year + 1900,
tm_.tm_mon + 1,
tm_.tm_mday,
tm_.tm_hour,
tm_.tm_min,
tm_.tm_sec);
for(size_t i=0 ; buf[i] ; ++i)
buffer += buf[i];
return *this;
}
#endif