Skip to content

Commit 996d4e2

Browse files
committed
[brres-sys] Don't feature-gate date formatting to Windows
Not sure why Apple doesn't support this still. Workaround with fmt. https://en.cppreference.com/w/cpp/chrono/system_clock/formatter https://en.cppreference.com/w/cpp/compiler_support#C.2B.2B20_library_features
1 parent 42808a0 commit 996d4e2

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

source/brres/lib/brres-sys/src/librii/crate/g3d_crate.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <rsl/ArrayUtil.hpp>
1010
#include <rsl/WriteFile.hpp>
1111

12+
#include <fmt/chrono.h>
13+
1214
extern const char GIT_TAG[] __attribute__((weak)) = "`brres` pre-release";
1315
extern const char RII_TIME_STAMP[] __attribute__((weak)) = "`brres` pre-release";
1416

@@ -458,9 +460,7 @@ Result<std::vector<u8>> WriteRSPreset(const CrateAnimation& preset, bool cli) {
458460
auto json = preset.metadata_json;
459461
// Fill in date field
460462
const auto now = std::chrono::system_clock::now();
461-
#if defined(_WIN32)
462-
json["date_created"] = std::format("{:%B %d, %Y}", now);
463-
#endif
463+
json["date_created"] = fmt::format("{:%B %d, %Y}", now);
464464
json["tool"] = std::format("RiiStudio {}{}", cli ? "CLI " : "",
465465
std::string_view(GIT_TAG));
466466

source/librii/crate/g3d_crate.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#define BRRES_SYS_NO_EXPECTED
1212
#include <brres/lib/brres-sys/include/brres_sys.h>
1313

14+
#include <fmt/chrono.h>
15+
1416
namespace librii::crate {
1517

1618
Result<std::vector<u8>> WriteMDL0Mat(const g3d::G3dMaterialData& mat) {
@@ -230,9 +232,7 @@ Result<std::vector<u8>> WriteRSPreset(const CrateAnimation& preset, bool cli) {
230232
auto json = preset.metadata_json;
231233
// Fill in date field
232234
const auto now = std::chrono::system_clock::now();
233-
#if defined(_WIN32)
234-
json["date_created"] = std::format("{:%B %d, %Y}", now);
235-
#endif
235+
json["date_created"] = fmt::format("{:%B %d, %Y}", now);
236236
json["tool"] = std::format("RiiStudio {}{}", cli ? "CLI " : "",
237237
std::string_view(GIT_TAG));
238238

source/librii/crate/j3d_crate.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include <rsl/ArrayUtil.hpp>
66
#include <rsl/WriteFile.hpp>
77

8+
#include <fmt/chrono.h>
9+
810
namespace librii::crate {
911

1012
struct SimpleTransaction {
@@ -62,9 +64,7 @@ WriteRSPresetJ3D(const CrateAnimationJ3D& preset, bool cli) {
6264
auto json = preset.metadata_json;
6365
// Fill in date field
6466
const auto now = std::chrono::system_clock::now();
65-
#if defined(_WIN32)
66-
json["date_created"] = std::format("{:%B %d, %Y}", now);
67-
#endif
67+
json["date_created"] = fmt::format("{:%B %d, %Y}", now);
6868
json["tool"] = std::format("RiiStudio {}{}", cli ? "CLI " : "",
6969
std::string_view(GIT_TAG));
7070

0 commit comments

Comments
 (0)