From 5441eb3bc44ebfa2ec7aba4ff5825cb7a548be38 Mon Sep 17 00:00:00 2001 From: Dan Notestein Date: Wed, 7 Jan 2026 14:56:41 -0500 Subject: [PATCH] Fix WASM build: exclude syscall-based timestamps for Emscripten The iso_8601_realtime_microseconds time format uses Linux syscall() to bypass libfaketime, but this is unavailable in Emscripten/WASM. Add __EMSCRIPTEN__ check alongside _WIN32 to use the fallback path. --- src/log/appender.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/log/appender.cpp b/src/log/appender.cpp index 7494fe0..5016727 100644 --- a/src/log/appender.cpp +++ b/src/log/appender.cpp @@ -11,7 +11,7 @@ #include "console_defines.h" #include -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__EMSCRIPTEN__) #include #include #endif @@ -67,7 +67,7 @@ namespace fc { break; case appender::time_format::iso_8601_realtime_microseconds: { -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__EMSCRIPTEN__) // Use syscall directly to bypass libfaketime interception struct timespec ts; syscall(SYS_clock_gettime, CLOCK_REALTIME, &ts); @@ -77,7 +77,7 @@ namespace fc { result << std::put_time(&utc_tm, "%Y-%m-%dT%H:%M:%S") << '.' << std::setfill('0') << std::setw(6) << (ts.tv_nsec / 1000); #else - // On Windows, just use regular time (libfaketime is Linux-only anyway) + // On Windows/WASM, just use regular time (libfaketime is Linux-only anyway) result << time.to_iso_string_in_microseconds(); #endif } -- GitLab