diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index b89a67b19..e2070d546 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -7,6 +7,7 @@
 #include "eval-inline.hh"
 #include "download.hh"
 #include "json.hh"
+#include "function-trace.hh"
 
 #include <algorithm>
 #include <chrono>
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh
index 419b703fc..85aa1ccfe 100644
--- a/src/libexpr/eval.hh
+++ b/src/libexpr/eval.hh
@@ -6,7 +6,6 @@
 #include "symbol-table.hh"
 #include "hash.hh"
 #include "config.hh"
-#include "function-trace.hh"
 
 #include <map>
 #include <optional>
diff --git a/src/libexpr/function-trace.hh b/src/libexpr/function-trace.hh
index 8b0ec848d..2c39b7430 100644
--- a/src/libexpr/function-trace.hh
+++ b/src/libexpr/function-trace.hh
@@ -1,7 +1,8 @@
 #pragma once
 
 #include "eval.hh"
-#include <sys/time.h>
+
+#include <chrono>
 
 namespace nix {