diff --git a/cbits/cycles.c b/cbits/cycles.c
--- a/cbits/cycles.c
+++ b/cbits/cycles.c
@@ -68,6 +68,18 @@
   return result;
 }
 
+#elif wasm32_HOST_ARCH
+
+#include <time.h>
+
+StgWord64 criterion_rdtsc(void)
+{
+  struct timespec ts;
+  StgWord64 result_stg = 0;
+  clock_gettime(CLOCK_REALTIME, &ts);
+  result_stg = ts.tv_sec * 1000000000LL + ts.tv_nsec;
+  return result_stg;
+}
 #else
 
 #error Unsupported OS/architecture/compiler!
diff --git a/cbits/time-posix.c b/cbits/time-posix.c
--- a/cbits/time-posix.c
+++ b/cbits/time-posix.c
@@ -18,7 +18,11 @@
 {
     struct timespec ts;
 
+#ifndef __wasi__
     clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
+#else
+    clock_gettime(CLOCK_REALTIME, &ts);
+#endif
 
     return ts.tv_sec + ts.tv_nsec * 1e-9;
 }
diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,7 @@
+0.2.4.0
+
+* Support building with `wasm32-wasi`.
+
 0.2.3.0
 
 * Drop support for pre-8.0 versions of GHC.
diff --git a/criterion-measurement.cabal b/criterion-measurement.cabal
--- a/criterion-measurement.cabal
+++ b/criterion-measurement.cabal
@@ -1,5 +1,5 @@
 name:                criterion-measurement
-version:             0.2.3.0
+version:             0.2.4.0
 synopsis:            Criterion measurement functionality and associated types
 description:         Measurement-related functionality extracted from Criterion, with minimal dependencies. The rationale for this is to enable alternative analysis front-ends.
 homepage:            https://github.com/haskell/criterion
@@ -22,9 +22,10 @@
   GHC==9.0.2,
   GHC==9.2.8,
   GHC==9.4.8,
-  GHC==9.6.6,
-  GHC==9.8.2,
-  GHC==9.10.1
+  GHC==9.6.7,
+  GHC==9.8.4,
+  GHC==9.10.3,
+  GHC==9.12.2
 
 flag fast
   description: compile without optimizations
