Patch-Source: https://github.com/kilobyte/termrec/commit/8c594d7caf3f3fc706a93746ac31e3f90bbfadcf From 8c594d7caf3f3fc706a93746ac31e3f90bbfadcf Mon Sep 17 00:00:00 2001 From: Adam Borowski Date: Mon, 1 Sep 2025 23:12:24 +0200 Subject: [PATCH] Fix asciicast failing on some 32-bit archs with 64-bit time_t. --- libtty/asciicast.c | 2 +- tests/vt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libtty/asciicast.c b/libtty/asciicast.c index 7f062c7..c12449d 100644 --- a/libtty/asciicast.c +++ b/libtty/asciicast.c @@ -487,7 +487,7 @@ void record_asciicast(FILE *f, void* state, const struct timeval *tm, const char fprintf(f, "{\"version\":%d, \"width\":%d, \"height\":%d", as->version, vt->sx, vt->sy); if (as->ts.tv_sec) - fprintf(f, ", \"timestamp\":%ld", as->ts.tv_sec); + fprintf(f, ", \"timestamp\":%lld", (long long int)as->ts.tv_sec); if (as->version == 1) fprintf(f, ", \"stdout\":[\n"); else diff --git a/tests/vt.c b/tests/vt.c index 439e177..5e97a0a 100644 --- a/tests/vt.c +++ b/tests/vt.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "tty.h" #include "wcwidth.h" @@ -50,7 +50,7 @@ static const char* describe_attr(uint64_t attr) b+=sprintf(b, " bg="), b+=describe_color(b, attr>>32); #define INVALID_ATTRS 0x7000000080000000 if (attr & INVALID_ATTRS) - b+=sprintf(b, "bad_attr:%lx", attr & INVALID_ATTRS); + b+=sprintf(b, "bad_attr:%"PRIx64, attr & INVALID_ATTRS); return *buf? buf+1 : buf; }