X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftime%2Ftimezone.cpp;h=7c837484c705239f06537e2781209b396c1ef4ba;hb=8e77a1c6747dddf585d653c34e9806e976d2c73a;hp=a96e1b51be34ef6672239c358210d4b766d212d5;hpb=c8c97ab483cfbf1bb3d0788cf729be92091ba2fc;p=libs%2Fcore.git diff --git a/source/time/timezone.cpp b/source/time/timezone.cpp index a96e1b5..7c83748 100644 --- a/source/time/timezone.cpp +++ b/source/time/timezone.cpp @@ -6,14 +6,13 @@ Distributed under the LGPL */ #include -#include -#include #ifdef WIN32 #include #else #include #endif -#include "../core/except.h" +#include +#include #include "timestamp.h" #include "timezone.h" #include "units.h" @@ -41,7 +40,7 @@ TimeZone get_local_timezone() TIME_ZONE_INFORMATION tzinfo; DWORD dst = GetTimeZoneInformation(&tzinfo); if(dst==TIME_ZONE_ID_INVALID) - throw Msp::SystemError("Failed to get time zone information", GetLastError()); + throw Msp::system_error("GetTimeZoneInformation"); int offset = tzinfo.Bias; if(dst==TIME_ZONE_ID_STANDARD) @@ -52,7 +51,7 @@ TimeZone get_local_timezone() return TimeZone(offset); #else int fd = open("/etc/localtime", O_RDONLY); - if(fd>=-1) + if(fd!=-1) { char hdr[44]; int len = read(fd, hdr, sizeof(hdr)); @@ -122,12 +121,10 @@ TimeZone::TimeZone(int minutes): { if(minutes) { - ostringstream ss; - ss.fill('0'); int m = abs(minutes); - ss<<"UTC"<<(minutes<0 ? '-' : '+')<