Skip to content
Permalink
Browse files

Common/SettingsHandler: Use fmt for printing out the serial number

Same thing, less code.
  • Loading branch information...
lioncash committed Jul 16, 2019
1 parent af57683 commit 13a454d603d379d6980d501cf117f5a61264d548
Showing with 3 additions and 4 deletions.
  1. +3 −4 Source/Core/Common/SettingsHandler.cpp
@@ -9,9 +9,10 @@
#include <cstddef>
#include <ctime>
#include <iomanip>
#include <sstream>
#include <string>

#include <fmt/time.h>

#include "Common/CommonTypes.h"

namespace Common
@@ -124,8 +125,6 @@ std::string SettingsHandler::GenerateSerialNumber()
// Must be 9 characters at most; otherwise the serial number will be rejected by SDK libraries,
// as there is a check to ensure the string length is strictly lower than 10.
// 3 for %j, 2 for %H, 2 for %M, 2 for %S.
std::stringstream stream;
stream << std::put_time(std::localtime(&t), "%j%H%M%S");
return stream.str();
return fmt::format("{:%j%H%M%S}", *std::localtime(&t));
}
} // namespace Common

0 comments on commit 13a454d

Please sign in to comment.
You can’t perform that action at this time.