summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-06-12 22:55:25 +0200
committerGitHub <noreply@github.com>2021-06-12 22:55:25 +0200
commitac73059b56b35e20258774755f9742d032f51f52 (patch)
tree957b4562f711730561f67b204cffc3b0ae2b72b7 /core/io
parentedee79862894538ba29f0d2d4e90bdc970ba9e1c (diff)
parentf64fea1b23df163485720c03054b3a17ae0c673a (diff)
Merge pull request #49123 from aaronfranke/it-is-time
Add a Time singleton
Diffstat (limited to 'core/io')
-rw-r--r--core/io/logger.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/core/io/logger.cpp b/core/io/logger.cpp
index 304581b4ac..09539f716c 100644
--- a/core/io/logger.cpp
+++ b/core/io/logger.cpp
@@ -33,6 +33,7 @@
#include "core/config/project_settings.h"
#include "core/io/dir_access.h"
#include "core/os/os.h"
+#include "core/os/time.h"
#include "core/string/print_string.h"
#if defined(MINGW_ENABLED) || defined(_MSC_VER)
@@ -156,11 +157,7 @@ void RotatedFileLogger::rotate_file() {
if (FileAccess::exists(base_path)) {
if (max_files > 1) {
- char timestamp[21];
- OS::Date date = OS::get_singleton()->get_date();
- OS::Time time = OS::get_singleton()->get_time();
- sprintf(timestamp, "_%04d-%02d-%02d_%02d.%02d.%02d", date.year, date.month, date.day, time.hour, time.min, time.sec);
-
+ String timestamp = Time::get_singleton()->get_datetime_string_from_system().replace(":", ".");
String backup_name = base_path.get_basename() + timestamp;
if (base_path.get_extension() != String()) {
backup_name += "." + base_path.get_extension();