]> git.tdb.fi Git - libs/core.git/commitdiff
Use format instead of stringstream in TimeZone
authorMikko Rasa <tdb@tdb.fi>
Mon, 30 May 2011 20:24:54 +0000 (23:24 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 30 May 2011 20:24:54 +0000 (23:24 +0300)
source/time/timezone.cpp

index a96e1b51be34ef6672239c358210d4b766d212d5..0ec9d2b8e4137300f3139bfb2f5661e7fe3a0764 100644 (file)
@@ -6,13 +6,12 @@ Distributed under the LGPL
 */
 
 #include <cstdlib>
-#include <sstream>
-#include <iomanip>
 #ifdef WIN32
 #include <windows.h>
 #else
 #include <fcntl.h>
 #endif
+#include <msp/strings/format.h>
 #include "../core/except.h"
 #include "timestamp.h"
 #include "timezone.h"
@@ -122,12 +121,10 @@ TimeZone::TimeZone(int minutes):
 {
        if(minutes)
        {
-               ostringstream ss;
-               ss.fill('0');
                int m = abs(minutes);
-               ss<<"UTC"<<(minutes<0 ? '-' : '+')<<m/60;
+               name = format("UTC%c%d", (minutes<0 ? '-' : '+'), m/60);
                if(m%60)
-                       ss<<':'<<setw(2)<<m%60;
+                       name += format(":%02d", m%60);
        }
        else
                name = "UTC";