#include "TimeFunc.h" #include "stringutils.h" #include "boostheaders.h" PackedTime strtime::getCurrentUtc(){ PackedTime result; SYSTEMTIME st; GetSystemTime(&st); SystemTimeToFileTime(&st, &result); return result; } std::string strtime::toLocalDate(const PackedTime &utcTime) { PackedTime local; SYSTEMTIME st; FileTimeToLocalFileTime(&utcTime, &local); FileTimeToSystemTime(&local, &st); boost::format fd("%02d.%02d.%04d"); fd % st.wDay % st.wMonth % st.wYear; return fd.str(); } std::string strtime::toLocalTime(const PackedTime &utcTime) { PackedTime local; SYSTEMTIME st; FileTimeToLocalFileTime(&utcTime, &local); FileTimeToSystemTime(&local, &st); boost::format tf("%02d:%02d:%02d"); tf % st.wHour % st.wMinute % st.wSecond; return tf.str(); } std::string strtime::toLocalDateTime(const PackedTime &utcTime) { return toLocalDate(utcTime)+", "+toLocalTime(utcTime); } int extractInt(const std::string &s, int nbegin, int nend) { int result=0; for (int index=nbegin; index