tech-kern 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 16:49:20 +0900
   From: Ryota Ozaki <ozaki-r%netbsd.org@localhost>

   http://www.netbsd.org/~ozaki-r/use-time_uptime.diff

   This patch replaces time_second with time_uptime.
   Additionally it converts a time based on time_uptime
   to a time based on time_second when the kernel passes
   the time to userland programs that expect the latter,
   and vice versa.

Sounds like a good idea to me, though I can't review any details
related to the network stack.  One tiny nit:

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


Home | Main Index | Thread Index | Old Index