void DateTime::convert_timezone(const TimeZone &tz)
{
- add_raw((zone.get_offset()-tz.get_offset()).raw());
+ add_raw((tz.get_offset()-zone.get_offset()).raw());
zone = tz;
}
if(const TimeDelta &offs = zone.get_offset())
{
int m = abs(static_cast<int>(offs/Time::min));
- result += Msp::format("%c%02d:%02d", (offs<zero ? '+' : '-'), m/60, m%60);
+ result += Msp::format("%c%02d:%02d", (offs<zero ? '-' : '+'), m/60, m%60);
}
else
result += 'Z';
close(fd);
if(gmtoff!=-1)
- return TimeZone(-gmtoff/60, name);
+ return TimeZone(gmtoff/60, name);
}
return TimeZone();
#endif
name("UTC")
{ }
-TimeZone::TimeZone(int minutes_west):
- offset(minutes_west*min)
+TimeZone::TimeZone(int minutes):
+ offset(minutes*min)
{
- if(minutes_west)
+ if(minutes)
{
ostringstream ss;
ss.fill('0');
- int m = abs(minutes_west);
- ss<<"UTC"<<(minutes_west<0 ? '-' : '+')<<m/60;
+ int m = abs(minutes);
+ ss<<"UTC"<<(minutes<0 ? '-' : '+')<<m/60;
if(m%60)
ss<<':'<<setw(2)<<m%60;
}
name = "UTC";
}
-TimeZone::TimeZone(int minutes_west, const string &n):
+TimeZone::TimeZone(int minutes, const string &n):
name(n),
- offset(minutes_west*min)
+ offset(minutes*min)
{ }
const TimeZone &TimeZone::utc()