namespace PT renamed to pt
This commit is contained in:
@@ -57,7 +57,7 @@ void TimeZone::Dst::Clear()
|
||||
}
|
||||
|
||||
|
||||
bool TimeZone::Dst::IsDstUsed(const PT::Date & date) const
|
||||
bool TimeZone::Dst::IsDstUsed(const pt::Date & date) const
|
||||
{
|
||||
if( !has_dst )
|
||||
return false;
|
||||
@@ -70,7 +70,7 @@ return false;
|
||||
}
|
||||
|
||||
|
||||
int TimeZone::Dst::Compare(const PT::Date & date1, const PT::Date & date2) const
|
||||
int TimeZone::Dst::Compare(const pt::Date & date1, const pt::Date & date2) const
|
||||
{
|
||||
// year is ignored
|
||||
|
||||
@@ -135,7 +135,7 @@ return &i->second;
|
||||
|
||||
|
||||
|
||||
time_t TimeZone::CalcLocalOffset(const PT::Date & utc_date)
|
||||
time_t TimeZone::CalcLocalOffset(const pt::Date & utc_date)
|
||||
{
|
||||
time_t dst_offset = 0;
|
||||
|
||||
@@ -151,22 +151,22 @@ return offset + dst_offset;
|
||||
|
||||
time_t TimeZone::ToLocal(time_t utc_time)
|
||||
{
|
||||
time_t offset = CalcLocalOffset(PT::Date(utc_time));
|
||||
time_t offset = CalcLocalOffset(pt::Date(utc_time));
|
||||
|
||||
return utc_time + offset;
|
||||
}
|
||||
|
||||
|
||||
PT::Date TimeZone::ToLocal(const PT::Date & utc_date)
|
||||
pt::Date TimeZone::ToLocal(const pt::Date & utc_date)
|
||||
{
|
||||
PT::Date local(utc_date);
|
||||
pt::Date local(utc_date);
|
||||
local += CalcLocalOffset(utc_date);
|
||||
|
||||
return local;
|
||||
}
|
||||
|
||||
|
||||
time_t TimeZone::CalcUTCOffset(const PT::Date & local_date)
|
||||
time_t TimeZone::CalcUTCOffset(const pt::Date & local_date)
|
||||
{
|
||||
time_t dst_offset = 0;
|
||||
|
||||
@@ -175,7 +175,7 @@ time_t dst_offset = 0;
|
||||
if( dst && dst->has_dst )
|
||||
{
|
||||
// dst date ranges we have in UTC
|
||||
PT::Date utc(local_date);
|
||||
pt::Date utc(local_date);
|
||||
utc -= (offset + dst->offset);
|
||||
|
||||
if( dst->IsDstUsed(utc) )
|
||||
@@ -189,17 +189,17 @@ return offset + dst_offset;
|
||||
|
||||
time_t TimeZone::ToUTC(time_t local_time)
|
||||
{
|
||||
time_t offset = CalcUTCOffset(PT::Date(local_time));
|
||||
time_t offset = CalcUTCOffset(pt::Date(local_time));
|
||||
|
||||
return local_time - offset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PT::Date TimeZone::ToUTC(const PT::Date & local_date)
|
||||
pt::Date TimeZone::ToUTC(const pt::Date & local_date)
|
||||
{
|
||||
time_t offset;
|
||||
PT::Date utc(local_date);
|
||||
pt::Date utc(local_date);
|
||||
|
||||
offset = CalcUTCOffset(local_date);
|
||||
utc -= offset;
|
||||
@@ -211,7 +211,7 @@ return utc;
|
||||
|
||||
time_t TimeZone::ParseStrOffset(const wchar_t * str)
|
||||
{
|
||||
PT::Date date;
|
||||
pt::Date date;
|
||||
bool is_sign = false;
|
||||
time_t offset = 0;
|
||||
|
||||
@@ -240,7 +240,7 @@ return offset;
|
||||
}
|
||||
|
||||
|
||||
time_t TimeZone::GetOffset(PT::Space & space)
|
||||
time_t TimeZone::GetOffset(pt::Space & space)
|
||||
{
|
||||
std::wstring * offset_str = space.get_wstr(L"offset_str");
|
||||
|
||||
@@ -251,7 +251,7 @@ time_t TimeZone::GetOffset(PT::Space & space)
|
||||
}
|
||||
|
||||
|
||||
bool TimeZone::SetTzDst(PT::Space & year)
|
||||
bool TimeZone::SetTzDst(pt::Space & year)
|
||||
{
|
||||
time_t h24 = 60 * 60 * 24; // 24 hours
|
||||
bool result = true;
|
||||
@@ -291,7 +291,7 @@ return result;
|
||||
}
|
||||
|
||||
|
||||
bool TimeZone::SetTz(PT::Space & space)
|
||||
bool TimeZone::SetTz(pt::Space & space)
|
||||
{
|
||||
bool result = true;
|
||||
name.clear();
|
||||
@@ -306,13 +306,13 @@ bool TimeZone::SetTz(PT::Space & space)
|
||||
if( offset < -h24 || offset > h24 )
|
||||
result = false;
|
||||
|
||||
PT::Space * dst = space.find_child_space(L"dst");
|
||||
pt::Space * dst = space.find_child_space(L"dst");
|
||||
|
||||
if( dst && dst->child_spaces )
|
||||
{
|
||||
for(size_t i=0 ; i<dst->child_spaces->size() ; ++i)
|
||||
{
|
||||
PT::Space & year = *(*dst->child_spaces)[i];
|
||||
pt::Space & year = *(*dst->child_spaces)[i];
|
||||
|
||||
if( !SetTzDst(year) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user