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



On Wed, Aug 5, 2015 at 11:22 PM, Taylor R Campbell
<campbell+netbsd-tech-kern%mumble.net@localhost> wrote:
>    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)

I agree that's better. I fixed the patch. Thanks!

  ozaki-r


Home | Main Index | Thread Index | Old Index