mirror of
https://github.com/DanielSWolf/rhubarb-lip-sync.git
synced 2026-11-21 12:25:08 +00:00
Replaced Boost.Log with small custom logger
Boost.Log is a complex monstrosity and I can't get it to build on OS X.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "tools.h"
|
||||
#include <format.h>
|
||||
#include <chrono>
|
||||
#include <vector>
|
||||
|
||||
using std::string;
|
||||
using std::chrono::duration;
|
||||
@@ -8,3 +9,14 @@ using std::chrono::duration;
|
||||
string formatDuration(duration<double> seconds) {
|
||||
return fmt::format("{0:.2f}", seconds.count());
|
||||
}
|
||||
|
||||
string formatTime(time_t time, const string& format) {
|
||||
tm* timeInfo = localtime(&time);
|
||||
std::vector<char> buffer(20);
|
||||
bool success = false;
|
||||
while (!success) {
|
||||
success = strftime(buffer.data(), buffer.size(), format.c_str(), timeInfo) != 0;
|
||||
if (!success) buffer.resize(buffer.size() * 2);
|
||||
}
|
||||
return string(buffer.data());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user