Implement FS defragmentation

This commit is contained in:
Vitaliy Filippov
2024-07-12 16:11:35 +03:00
parent 1771d2ef36
commit 990c3ba7eb
16 changed files with 893 additions and 133 deletions
+11
View File
@@ -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, &lt);
int len = strftime(buf, 128, "%Y-%m-%d %H:%M:%S", &lt);
return std::string(buf, len);
}