Initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#include "Util.h"
|
||||
#include <array>
|
||||
#include <ctime>
|
||||
|
||||
|
||||
namespace CameraRecorder {
|
||||
namespace Recorder {
|
||||
|
||||
std::string GetDateTimeString(bool omitSeparator)
|
||||
{
|
||||
std::array<char, 17> buffer;
|
||||
buffer.fill(0);
|
||||
std::time_t t = std::time(nullptr);
|
||||
std::tm* tm = std::localtime(&t);
|
||||
|
||||
if (omitSeparator)
|
||||
strftime(buffer.data(), sizeof(buffer), "%Y%m%d%H%M%S", tm);
|
||||
else
|
||||
strftime(buffer.data(), sizeof(buffer), "%Y%m%d-%H%M%S", tm);
|
||||
|
||||
return buffer.data();
|
||||
}
|
||||
|
||||
} // namespace Recorder
|
||||
} // namespace CameraRecorder
|
||||
Reference in New Issue
Block a user