removed: in some places a dependencies to tm struct has left

removed: operator<<(tm&) from streams: textstream, log, dbtextstream, htmltextstream



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@840 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2012-05-27 18:11:34 +00:00
parent 1b858f5782
commit 9d5d088b4a
14 changed files with 24 additions and 159 deletions

View File

@@ -156,7 +156,7 @@ return res;
const std::wstring & DbBase::AssertValueWide(PGresult * r, int row, int col)
{
const char * res = AssertValue(r, row, col);
static std::wstring temp_wide_value; // !! dac jako skladowa klasy (niestatyczna)
static std::wstring temp_wide_value; // !! IMPROVE ME add as a class field (nonstatic)
PT::UTF8ToWide(res, temp_wide_value);
@@ -217,11 +217,6 @@ unsigned int DbBase::AssertValueUInt(PGresult * r, int row, int col)
}
tm DbBase::AssertValueTm(PGresult * r, int row, int col)
{
return ConvertTime(AssertValue(r, row, col));
}
PT::Date DbBase::AssertValueDate(PGresult * r, int row, int col)
{
@@ -338,55 +333,8 @@ return AssertValueLong(r, 0, 0);
tm DbBase::ConvertTime(const char * str)
{
tm t;
memset(&t, 0, sizeof(t));
if( !str )
return t;
size_t len = strlen(str);
if( len != 19 )
{
// the format must be like this: 2008-12-31 22:30:00
log << log1 << "DbBase: ConvertTime: unknown time format: \"" << str << "\"" << logend;
return t;
}
t.tm_year = Toi(str + 0) - 1900; /* year - 1900 */
t.tm_mon = Toi(str + 5) - 1; /* month of year (0 - 11) */
t.tm_mday = Toi(str + 8); /* day of month (1 - 31) */
t.tm_hour = Toi(str + 11); /* hours (0 - 23) */
t.tm_min = Toi(str + 14); /* minutes (0 - 59) */
t.tm_sec = Toi(str + 17); /* seconds (0 - 60) */
// t.tm_wday = 0; /* day of week (Sunday = 0) */
// t.tm_yday = 0; /* day of year (0 - 365) */
// t.tm_isdst = 0; /* is summer time in effect? */
// t.tm_zone = 0; // const_cast<char*>(""); /* abbreviation of timezone name */
return t;
}
const char * DbBase::ConvertTime(const tm & t)
{
// not thread safe
static char buffer[100];
sprintf(buffer, "%04d-%02d-%02d %02d:%02d:%02d",
t.tm_year + 1900,
t.tm_mon + 1,
t.tm_mday,
t.tm_hour,
t.tm_min,
t.tm_sec);
return buffer;
}