diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index ecff434b2..5abb2b9bb 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -54,6 +54,7 @@ //#include #include #include +#include #include #include #define MD5_DIGEST_LENGTH 16 @@ -623,6 +624,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 8ef730d52..75e3e4107 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -71,6 +71,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");