Received: from eggs.gnu.org ([2001:4830:134:3::10]:52652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6yYj-0004Xr-Uq for qemu-devel@nongnu.org; Wed, 07 Aug 2013 03:53:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6yYa-0005fm-62 for qemu-devel@nongnu.org; Wed, 07 Aug 2013 03:53:29 -0400 Date: Wed, 7 Aug 2013 09:53:16 +0200 From: Stefan Hajnoczi Message-ID: <20130807075316.GG19825@stefanha-thinkpad.redhat.com> References: <1375789738-28034-1-git-send-email-stefanha@redhat.com> <52019428.2050302@comstyle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <52019428.2050302@comstyle.com> Subject: Re: [Qemu-devel] [PATCH for-1.6] qemu-timer: fix get_clock() gettimeofday() fallback #ifdef List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Brad Smith Cc: Anthony Liguori , qemu-devel@nongnu.org, Stefan Hajnoczi , qemu-stable@nongnu.org On Tue, Aug 06, 2013 at 08:26:16PM -0400, Brad Smith wrote: > On 06/08/13 7:48 AM, Stefan Hajnoczi wrote: > >If CLOCK_MONOTONIC is not defined by system headers we use > >gettimeofday(2). Apparently this is not used very often since no one > >noticed the #ifdef was actually broken and left the function definition > >unterminated. > > Can you show what this supposedly fixes? This code built just fine on > OpenBSD before d05ef160453e98546a4197496dc8a3cb2defac53. Hi Brad, thanks for pointing this out. I misread the code: static inline int64_t get_clock(void) { #ifdef CLOCK_MONOTONIC if (use_rt_clock) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return ts.tv_sec * 1000000000LL + ts.tv_nsec; } else #endif <--- thought this was #else { /* XXX: using gettimeofday leads to problems if the date changes, so it should be avoided. */ return get_clock_realtime(); } } #endif <--- this is actually for #ifdef _WIN32 So I thought the function definition would not be terminated properly. But after you mentioned it, my change makes no sense. Dropping this patch. Thanks, Stefan