Implement FS defragmentation
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
#include "str_util.h"
|
||||
|
||||
@@ -474,3 +475,13 @@ std::string realpath_str(std::string path, bool nofail)
|
||||
free(p);
|
||||
return rp;
|
||||
}
|
||||
|
||||
std::string format_datetime(uint64_t unixtime)
|
||||
{
|
||||
char buf[128];
|
||||
time_t ut = (time_t)unixtime;
|
||||
tm lt;
|
||||
localtime_r(&ut, <);
|
||||
int len = strftime(buf, 128, "%Y-%m-%d %H:%M:%S", <);
|
||||
return std::string(buf, len);
|
||||
}
|
||||
|
||||
@@ -30,3 +30,4 @@ std::string scan_escaped(const std::string & cmd, size_t & pos, bool allow_unquo
|
||||
std::string auto_addslashes(const std::string & str, const char *toescape = "\\\"");
|
||||
std::string addslashes(const std::string & str, const char *toescape = "\\\"");
|
||||
std::string realpath_str(std::string path, bool nofail = true);
|
||||
std::string format_datetime(uint64_t unixtime);
|
||||
|
||||
Reference in New Issue
Block a user