helpers: add function to get backup suffix

Origin commit data
------------------
Branch: ni/coolstream
Commit: 427a949807
Author: vanhofen <vanhofen@gmx.de>
Date: 2020-11-12 (Thu, 12 Nov 2020)

Origin message was:
------------------
- helpers: add function to get backup suffix

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2020-11-12 22:17:34 +01:00
parent d0eb388f76
commit 21585e72de
2 changed files with 9 additions and 0 deletions

View File

@@ -54,6 +54,7 @@
//#include <driver/framebuffer.h>
#include <system/helpers.h>
#include <system/helpers-json.h>
#include <lib/libnet/libnet.h>
#include <gui/update_ext.h>
#include <libmd5sum.h>
#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)
{

View File

@@ -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");