tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Replace time_second with time_uptime in some places



   Date: Wed, 5 Aug 2015 14:18:37 +0000
   From: Taylor R Campbell <campbell+netbsd-tech-kern%mumble.net@localhost>

      +#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)


Home | Main Index | Thread Index | Old Index