diff --git a/mesh/agent.c b/mesh/agent.c
index 2f9697a3330c..a1413c0008dc 100644
--- a/mesh/agent.c
+++ b/mesh/agent.c
@@ -12,6 +12,8 @@
 #include <config.h>
 #endif
 
+#include <time.h>
+
 #include <ell/ell.h>
 
 #include "mesh/mesh.h"
diff --git a/mesh/appkey.c b/mesh/appkey.c
index f31d8194298e..b03ddae4714d 100644
--- a/mesh/appkey.c
+++ b/mesh/appkey.c
@@ -12,6 +12,8 @@
 #include <config.h>
 #endif
 
+#include <time.h>
+
 #define _GNU_SOURCE
 #include <ell/ell.h>
 
diff --git a/mesh/cfgmod-server.c b/mesh/cfgmod-server.c
index f64566daf39e..e5d5a86e0d8e 100644
--- a/mesh/cfgmod-server.c
+++ b/mesh/cfgmod-server.c
@@ -13,6 +13,7 @@
 #endif
 
 #include <sys/time.h>
+#include <time.h>
 #include <ell/ell.h>
 
 #include "mesh/mesh-defs.h"
diff --git a/mesh/crypto.c b/mesh/crypto.c
index b712a26549ad..b7607bb83794 100644
--- a/mesh/crypto.c
+++ b/mesh/crypto.c
@@ -15,6 +15,7 @@
 #define _GNU_SOURCE
 #include <unistd.h>
 #include <sys/socket.h>
+#include <time.h>
 #include <ell/ell.h>
 
 #include "mesh/mesh-defs.h"
diff --git a/mesh/dbus.c b/mesh/dbus.c
index a7abdc428e88..c43d6550d87f 100644
--- a/mesh/dbus.c
+++ b/mesh/dbus.c
@@ -12,6 +12,8 @@
 #include <config.h>
 #endif
 
+#include <time.h>
+
 #include <ell/ell.h>
 
 #include "mesh/mesh-defs.h"
diff --git a/mesh/friend.c b/mesh/friend.c
index 5b73da68916f..6aacf6338f24 100644
--- a/mesh/friend.c
+++ b/mesh/friend.c
@@ -12,6 +12,8 @@
 #include <config.h>
 #endif
 
+#include <time.h>
+
 #include <ell/ell.h>
 
 #include "mesh/mesh-defs.h"
diff --git a/mesh/keyring.c b/mesh/keyring.c
index 1e1de3e54bfb..cb091e15b613 100644
--- a/mesh/keyring.c
+++ b/mesh/keyring.c
@@ -18,6 +18,7 @@
 #include <errno.h>
 #include <limits.h>
 #include <stdio.h>
+#include <time.h>
 #include <unistd.h>
 
 #include <sys/stat.h>
diff --git a/mesh/main.c b/mesh/main.c
index 145bcfa98d85..5b8af4bc7345 100644
--- a/mesh/main.c
+++ b/mesh/main.c
@@ -18,6 +18,7 @@
 #include <unistd.h>
 #include <ctype.h>
 #include <signal.h>
+#include <time.h>
 
 #include <sys/prctl.h>
 #include <sys/stat.h>
diff --git a/mesh/manager.c b/mesh/manager.c
index 0c98721bf4b5..63551b4ee4c7 100644
--- a/mesh/manager.c
+++ b/mesh/manager.c
@@ -12,6 +12,8 @@
 #include <config.h>
 #endif
 
+#include <time.h>
+
 #define _GNU_SOURCE
 #include <ell/ell.h>
 
diff --git a/mesh/mesh-config-json.c b/mesh/mesh-config-json.c
index 5372130d7f8a..86e7d87e482e 100644
--- a/mesh/mesh-config-json.c
+++ b/mesh/mesh-config-json.c
@@ -21,6 +21,7 @@
 #include <limits.h>
 #include <stdio.h>
 #include <string.h>
+#include <time.h>
 #include <unistd.h>
 
 #include <sys/time.h>
diff --git a/mesh/mesh-io-generic.c b/mesh/mesh-io-generic.c
index 13a863b48158..3da0a8c2d227 100644
--- a/mesh/mesh-io-generic.c
+++ b/mesh/mesh-io-generic.c
@@ -15,6 +15,7 @@
 #include <errno.h>
 #include <string.h>
 #include <sys/time.h>
+#include <time.h>
 #include <ell/ell.h>
 
 #include "monitor/bt.h"
diff --git a/mesh/mesh-io-mgmt.c b/mesh/mesh-io-mgmt.c
index 5f0eb206b3b2..d185f5c9760f 100644
--- a/mesh/mesh-io-mgmt.c
+++ b/mesh/mesh-io-mgmt.c
@@ -16,6 +16,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/time.h>
+#include <time.h>
 #include <ell/ell.h>
 
 #include "monitor/bt.h"
diff --git a/mesh/mesh-io-unit.c b/mesh/mesh-io-unit.c
index a9fa53308eb1..4fd72bf8480d 100644
--- a/mesh/mesh-io-unit.c
+++ b/mesh/mesh-io-unit.c
@@ -19,6 +19,7 @@
 #include <sys/un.h>
 #include <unistd.h>
 #include <stdio.h>
+#include <time.h>
 #include <ell/ell.h>
 
 #include "mesh/mesh-defs.h"
diff --git a/mesh/mesh-io.c b/mesh/mesh-io.c
index b953bf4cff81..99c7c2014375 100644
--- a/mesh/mesh-io.c
+++ b/mesh/mesh-io.c
@@ -12,6 +12,8 @@
 #include <config.h>
 #endif
 
+#include <time.h>
+
 #include <ell/ell.h>
 
 #include "lib/bluetooth.h"
diff --git a/mesh/mesh-mgmt.c b/mesh/mesh-mgmt.c
index fd21a168ab27..87036d180fe0 100644
--- a/mesh/mesh-mgmt.c
+++ b/mesh/mesh-mgmt.c
@@ -12,6 +12,8 @@
 #include <config.h>
 #endif
 
+#include <time.h>
+
 #include <ell/ell.h>
 
 #include "lib/bluetooth.h"
diff --git a/mesh/mesh.c b/mesh/mesh.c
index 91cf25175384..50059adbed57 100644
--- a/mesh/mesh.c
+++ b/mesh/mesh.c
@@ -12,6 +12,8 @@
 #include <config.h>
 #endif
 
+#include <time.h>
+
 #define _GNU_SOURCE
 #include <ell/ell.h>
 
diff --git a/mesh/model.c b/mesh/model.c
index 4ccafa17edd4..01b21675c557 100644
--- a/mesh/model.c
+++ b/mesh/model.c
@@ -13,6 +13,7 @@
 #endif
 
 #include <sys/time.h>
+#include <time.h>
 #include <ell/ell.h>
 
 #include "mesh/mesh-defs.h"
diff --git a/mesh/net-keys.c b/mesh/net-keys.c
index 57a9df04a2a7..42d498ce0ede 100644
--- a/mesh/net-keys.c
+++ b/mesh/net-keys.c
@@ -12,6 +12,8 @@
 #include <config.h>
 #endif
 
+#include <time.h>
+
 #include <ell/ell.h>
 
 #include "mesh/mesh-defs.h"
diff --git a/mesh/net.c b/mesh/net.c
index 05ca48326fc5..cc862dade5ae 100644
--- a/mesh/net.c
+++ b/mesh/net.c
@@ -15,6 +15,7 @@
 #define _GNU_SOURCE
 
 #include <sys/time.h>
+#include <time.h>
 
 #include <ell/ell.h>
 
diff --git a/mesh/node.c b/mesh/node.c
index 93537c5ba4cc..a85814727d40 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -17,6 +17,7 @@
 #include <limits.h>
 #include <stdio.h>
 #include <sys/time.h>
+#include <time.h>
 
 #include <ell/ell.h>
 
diff --git a/mesh/pb-adv.c b/mesh/pb-adv.c
index 7a1dd87dc210..0b1fd7d577ff 100644
--- a/mesh/pb-adv.c
+++ b/mesh/pb-adv.c
@@ -12,6 +12,8 @@
 #include <config.h>
 #endif
 
+#include <time.h>
+
 #include <ell/ell.h>
 
 #include "mesh/mesh-defs.h"
diff --git a/mesh/prov-acceptor.c b/mesh/prov-acceptor.c
index fd9d4cd5d209..241345bdd1ea 100644
--- a/mesh/prov-acceptor.c
+++ b/mesh/prov-acceptor.c
@@ -12,6 +12,8 @@
 #include <config.h>
 #endif
 
+#include <time.h>
+
 #include <ell/ell.h>
 
 #include "src/shared/ecc.h"
diff --git a/mesh/prov-initiator.c b/mesh/prov-initiator.c
index e353d23865ef..dc19d1e9b7a5 100644
--- a/mesh/prov-initiator.c
+++ b/mesh/prov-initiator.c
@@ -12,6 +12,8 @@
 #include <config.h>
 #endif
 
+#include <time.h>
+
 #include <ell/ell.h>
 
 #include "src/shared/ecc.h"
diff --git a/mesh/prvbeac-server.c b/mesh/prvbeac-server.c
index dd0e4cbf449e..f318852b8a42 100644
--- a/mesh/prvbeac-server.c
+++ b/mesh/prvbeac-server.c
@@ -22,6 +22,7 @@
 #endif
 
 #include <sys/time.h>
+#include <time.h>
 #include <ell/ell.h>
 
 #include "mesh/mesh-defs.h"
diff --git a/mesh/remprv-server.c b/mesh/remprv-server.c
index 927dbab0e361..53c764f8626a 100644
--- a/mesh/remprv-server.c
+++ b/mesh/remprv-server.c
@@ -22,6 +22,7 @@
 #endif
 
 #include <sys/time.h>
+#include <time.h>
 #include <ell/ell.h>
 
 #include "src/shared/ad.h"
diff --git a/mesh/rpl.c b/mesh/rpl.c
index 69533bf431b4..8de4a8d567b1 100644
--- a/mesh/rpl.c
+++ b/mesh/rpl.c
@@ -19,6 +19,7 @@
 #include <unistd.h>
 #include <dirent.h>
 #include <errno.h>
+#include <time.h>
 
 #include <sys/stat.h>
 
diff --git a/src/shared/btp.c b/src/shared/btp.c
index e54eb830f9b4..04ccae9d81f1 100644
--- a/src/shared/btp.c
+++ b/src/shared/btp.c
@@ -11,6 +11,7 @@
 #include <stdbool.h>
 #include <sys/socket.h>
 #include <sys/un.h>
+#include <time.h>
 #include <unistd.h>
 
 #include <ell/ell.h>
diff --git a/src/shared/io-ell.c b/src/shared/io-ell.c
index dee9a95c945c..35dc38e2ee67 100644
--- a/src/shared/io-ell.c
+++ b/src/shared/io-ell.c
@@ -15,6 +15,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <sys/socket.h>
+#include <time.h>
 
 #include <ell/ell.h>
 
diff --git a/src/shared/mainloop-ell.c b/src/shared/mainloop-ell.c
index 5cc0311c2a42..1aec7fad9e96 100644
--- a/src/shared/mainloop-ell.c
+++ b/src/shared/mainloop-ell.c
@@ -16,6 +16,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <time.h>
 
 #include <ell/ell.h>
 
diff --git a/src/shared/timeout-ell.c b/src/shared/timeout-ell.c
index 02628692642a..7867c7570277 100644
--- a/src/shared/timeout-ell.c
+++ b/src/shared/timeout-ell.c
@@ -8,6 +8,8 @@
  *
  */
 
+#include <time.h>
+
 #include <ell/ell.h>
 
 #include "timeout.h"
diff --git a/tools/mesh/cfgcli.c b/tools/mesh/cfgcli.c
index 1a404af38ebd..fb6fa666d2db 100644
--- a/tools/mesh/cfgcli.c
+++ b/tools/mesh/cfgcli.c
@@ -14,6 +14,7 @@
 
 #include <stdio.h>
 #include <stdbool.h>
+#include <time.h>
 
 #include <ell/ell.h>
 
diff --git a/tools/mesh/keys.c b/tools/mesh/keys.c
index 134c1a10e210..d1d2ffefa1e6 100644
--- a/tools/mesh/keys.c
+++ b/tools/mesh/keys.c
@@ -12,6 +12,8 @@
 #include <config.h>
 #endif
 
+#include <time.h>
+
 #include <ell/ell.h>
 
 #include "src/shared/shell.h"
diff --git a/tools/mesh/remote.c b/tools/mesh/remote.c
index b917ae9df227..2d400081994e 100644
--- a/tools/mesh/remote.c
+++ b/tools/mesh/remote.c
@@ -12,6 +12,8 @@
 #include <config.h>
 #endif
 
+#include <time.h>
+
 #include <ell/ell.h>
 
 #include "src/shared/shell.h"
diff --git a/tools/mesh/util.c b/tools/mesh/util.c
index 6e81bf5f0285..c11010129f3e 100644
--- a/tools/mesh/util.c
+++ b/tools/mesh/util.c
@@ -13,6 +13,7 @@
 #endif
 
 #include <stdio.h>
+#include <time.h>
 
 #include <ell/ell.h>
 
