Date: Wed, 5 Aug 2015 14:18:37 +0000
From: Taylor R Campbell <[email protected]>
+#define TIME_MONO_TO_WALL(t) ((t) - time_uptime + time_second)
+#define TIME_WALL_TO_UP(t) ((t) + time_uptime - time_second)
As a paranoid defence against possible overflow, in case t is ever a
32-bit signed integer and not a 64-bit time_t, you should subtract
time_uptime first. And/or just make these static inlines instead of
macros.
Errr, I mean: do the subtraction first in both cases.
#define TIME_MONO_TO_WALL(t) ((t) - time_uptime + time_second)
#define TIME_WALL_TO_MONO(t) ((t) - time_second + time_uptime)