[Orxonox-commit 6464] r11114 - code/trunk/src/libraries/util

landauf at orxonox.net landauf at orxonox.net
Sun Feb 14 17:13:03 CET 2016


Author: landauf
Date: 2016-02-14 17:13:03 +0100 (Sun, 14 Feb 2016)
New Revision: 11114

Modified:
   code/trunk/src/libraries/util/StringUtils.cc
Log:
unfortunately std::put_time and std::get_time are only available in GCC 5+, so I have to revert this change.

Modified: code/trunk/src/libraries/util/StringUtils.cc
===================================================================
--- code/trunk/src/libraries/util/StringUtils.cc	2016-02-14 14:42:37 UTC (rev 11113)
+++ code/trunk/src/libraries/util/StringUtils.cc	2016-02-14 16:13:03 UTC (rev 11114)
@@ -505,7 +505,13 @@
         time_t ctTime; std::time(&ctTime);
         tm* pTime = std::localtime(&ctTime);
         std::ostringstream oss;
-        oss << std::put_time(pTime, "%m%d%Y_%H%M%S");
+//        oss << std::put_time(pTime, "%m%d%Y_%H%M%S"); // <-- std::put_time is only available in GCC 5+
+        oss << std::setw(2) << std::setfill('0') << (pTime->tm_mon + 1)
+            << std::setw(2) << std::setfill('0') << pTime->tm_mday
+            << std::setw(2) << std::setfill('0') << (pTime->tm_year + 1900)
+            << "_" << std::setw(2) << std::setfill('0') << pTime->tm_hour
+            << std::setw(2) << std::setfill('0') << pTime->tm_min
+            << std::setw(2) << std::setfill('0') << pTime->tm_sec;
         return oss.str();
     }
 }




More information about the Orxonox-commit mailing list