removed: dependencies to 'tz' system structure
now we are using PT::Date from pikotools git-svn-id: svn://ttmath.org/publicrep/winix/trunk@839 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -438,43 +438,34 @@ static wchar_t buffer[100];
|
||||
}
|
||||
|
||||
|
||||
const wchar_t * DateToStr(const tm * ptm)
|
||||
{
|
||||
return DateToStr(ptm->tm_year + 1900, ptm->tm_mon+1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
||||
}
|
||||
|
||||
|
||||
const wchar_t * DateToStr(const tm & rtm)
|
||||
const wchar_t * DateToStr(const PT::Date & d)
|
||||
{
|
||||
return DateToStr(rtm.tm_year + 1900, rtm.tm_mon+1, rtm.tm_mday, rtm.tm_hour, rtm.tm_min, rtm.tm_sec);
|
||||
return DateToStr(d.year, d.month, d.day, d.hour, d.min, d.sec);
|
||||
}
|
||||
|
||||
|
||||
const wchar_t * DateToStr(time_t t)
|
||||
{
|
||||
tm rtm = Time(t);
|
||||
PT::Date date = t;
|
||||
|
||||
return DateToStr(rtm);
|
||||
return DateToStr(date);
|
||||
}
|
||||
|
||||
|
||||
const wchar_t * DateToStrWithoutHours(const tm * ptm)
|
||||
{
|
||||
return DateToStr(ptm->tm_year + 1900, ptm->tm_mon+1, ptm->tm_mday);
|
||||
}
|
||||
|
||||
|
||||
const wchar_t * DateToStrWithoutHours(const tm & rtm)
|
||||
const wchar_t * DateToStrWithoutHours(const PT::Date & d)
|
||||
{
|
||||
return DateToStr(rtm.tm_year + 1900, rtm.tm_mon+1, rtm.tm_mday);
|
||||
return DateToStr(d.year, d.month, d.day);
|
||||
}
|
||||
|
||||
|
||||
const wchar_t * DateToStrWithoutHours(time_t t)
|
||||
{
|
||||
tm rtm = Time(t);
|
||||
PT::Date date = t;
|
||||
|
||||
return DateToStrWithoutHours(rtm);
|
||||
return DateToStrWithoutHours(date);
|
||||
}
|
||||
|
||||
|
||||
@@ -499,23 +490,19 @@ return buffer;
|
||||
}
|
||||
|
||||
|
||||
const char * DateToStrCookie(const tm * ptm)
|
||||
{
|
||||
return DateToStrCookie(ptm->tm_year + 1900, ptm->tm_mon+1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
||||
}
|
||||
|
||||
|
||||
const char * DateToStrCookie(const tm & rtm)
|
||||
const char * DateToStrCookie(const PT::Date & d)
|
||||
{
|
||||
return DateToStrCookie(rtm.tm_year + 1900, rtm.tm_mon+1, rtm.tm_mday, rtm.tm_hour, rtm.tm_min, rtm.tm_sec);
|
||||
return DateToStrCookie(d.year, d.month, d.day, d.hour, d.min, d.sec);
|
||||
}
|
||||
|
||||
|
||||
const char * DateToStrCookie(time_t t)
|
||||
{
|
||||
tm rtm = Time(t);
|
||||
PT::Date date = t;
|
||||
|
||||
return DateToStrCookie(rtm);
|
||||
return DateToStrCookie(date);
|
||||
}
|
||||
|
||||
|
||||
@@ -986,51 +973,6 @@ int SelectFileType(const std::wstring & file_name)
|
||||
}
|
||||
|
||||
|
||||
time_t Time(const tm & par)
|
||||
{
|
||||
tm t;
|
||||
|
||||
memset(&t, 0, sizeof(t));
|
||||
|
||||
t.tm_year = par.tm_year;
|
||||
t.tm_mon = par.tm_mon;
|
||||
t.tm_mday = par.tm_mday;
|
||||
t.tm_hour = par.tm_hour;
|
||||
t.tm_min = par.tm_min;
|
||||
t.tm_sec = par.tm_sec;
|
||||
|
||||
return timegm(&t);
|
||||
}
|
||||
|
||||
|
||||
time_t Time(const tm * par)
|
||||
{
|
||||
return Time(*par);
|
||||
}
|
||||
|
||||
|
||||
tm Time(time_t par)
|
||||
{
|
||||
tm * ptm = gmtime(&par);
|
||||
tm res;
|
||||
|
||||
memset(&res, 0, sizeof(res));
|
||||
|
||||
if( ptm )
|
||||
{
|
||||
res.tm_year = ptm->tm_year;
|
||||
res.tm_mon = ptm->tm_mon;
|
||||
res.tm_mday = ptm->tm_mday;
|
||||
res.tm_hour = ptm->tm_hour;
|
||||
res.tm_min = ptm->tm_min;
|
||||
res.tm_sec = ptm->tm_sec;
|
||||
res.tm_wday = ptm->tm_wday;
|
||||
res.tm_yday = ptm->tm_yday;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user