diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index f89a6c0c6..68baa41b0 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -53,6 +53,7 @@ //#include #include #include +#include #include #include #define MD5_DIGEST_LENGTH 16 @@ -493,6 +494,13 @@ std::string getFileExt(std::string &file) return _getBaseName(f, "."); } +std::string getBackupSuffix() +{ + std::string hostName = ""; + netGetHostname(hostName); + + return hostName + getNowTimeStr("_%Y%m%d_%H%M"); +} std::string getNowTimeStr(const char* format) { diff --git a/src/system/helpers.h b/src/system/helpers.h index a85f0d6be..6374f9e7b 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -69,6 +69,7 @@ std::string getPathName(std::string &path); std::string getBaseName(std::string &path); std::string getFileName(std::string &file); std::string getFileExt(std::string &file); +std::string getBackupSuffix(); std::string getNowTimeStr(const char* format); std::string trim(std::string& str, const std::string& trimChars = " \n\r\t"); std::string ltrim(std::string& str, const std::string& trimChars = " \n\r\t");