Fix overflow on nanoseconds which was causing issues on some platforms.