summaryrefslogtreecommitdiff
path: root/src/utils/stringutils.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-04-27 21:57:09 +0300
committerAndrei Karas <akaras@inbox.ru>2015-04-27 21:57:09 +0300
commitd0866a481199f01b68c00a319749f110f0439417 (patch)
tree5cb22903974592609775fbb3d81575fcb3a71f9f /src/utils/stringutils.cpp
parentcff8879242e1f692dee58ac764c5a54da1a996cd (diff)
downloadmanaplus-d0866a481199f01b68c00a319749f110f0439417.tar.gz
manaplus-d0866a481199f01b68c00a319749f110f0439417.tar.bz2
manaplus-d0866a481199f01b68c00a319749f110f0439417.tar.xz
manaplus-d0866a481199f01b68c00a319749f110f0439417.zip
Add into mail message field with date in string format.
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r--src/utils/stringutils.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index cde03d1b1..13d6501da 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -771,3 +771,14 @@ std::string removeToken(std::string &str, const std::string &token)
str.clear();
return str;
}
+
+std::string timeToStr(const int time)
+{
+ char buf[101];
+ const long tempTime = static_cast<long>(time);
+ tm *const timeInfo = localtime(&tempTime);
+ if (strftime(&buf[0], 100, "%Y-%m-%d_%H-%M-%S", timeInfo))
+ return std::string(buf);
+ else
+ return "unknown";
+}