summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/stringutils.cpp11
-rw-r--r--src/utils/stringutils.h2
2 files changed, 13 insertions, 0 deletions
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);