summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-03 19:52:21 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-03 19:52:21 +0300
commitf9d21161af483faa291f182c3607cc6298cf6be6 (patch)
tree7b33d63bedfbd63c3c7ee1aa52144a19794d1e6f
parenta361e595a3f8494903d8d66501cca2fe5b80307a (diff)
downloadplus-f9d21161af483faa291f182c3607cc6298cf6be6.tar.gz
plus-f9d21161af483faa291f182c3607cc6298cf6be6.tar.bz2
plus-f9d21161af483faa291f182c3607cc6298cf6be6.tar.xz
plus-f9d21161af483faa291f182c3607cc6298cf6be6.zip
Use date with time in seen and id logging files.
-rw-r--r--src/actormanager.cpp2
-rw-r--r--src/utils/stringutils.cpp11
-rw-r--r--src/utils/stringutils.h2
3 files changed, 14 insertions, 1 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index b569d6b99..cc46ac34b 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -1977,7 +1977,7 @@ void ActorManager::updateNameId(const std::string &name,
dir.append(idStr);
dir.append("/");
dir.append(stringToHexPath(name));
- const std::string dateStr = getDateString();
+ const std::string dateStr = getDateTimeString();
Files::saveTextFile(dir,
"info.txt",
(name + "\n").append(dateStr));
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 03f33688c..ebaee1b4b 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -709,6 +709,17 @@ std::string getDateString()
return std::string(buffer);
}
+std::string getDateTimeString()
+{
+ char buffer[80];
+ time_t rawtime;
+ time(&rawtime);
+ const tm *const timeinfo = localtime(&rawtime);
+
+ strftime(buffer, 79, "%Y-%m-%d %H:%M:%S", timeinfo);
+ return std::string(buffer);
+}
+
signed char parseBoolean(const std::string &value)
{
const std::string opt = value.substr(0, 1);
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 230445b75..25daf765f 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -236,6 +236,8 @@ bool strStartWith(const std::string &restrict str,
std::string getDateString() A_WARN_UNUSED;
+std::string getDateTimeString() A_WARN_UNUSED;
+
signed char parseBoolean(const std::string &value);
std::string encodeLinkText(std::string data);