From patchwork Fri Jan 6 07:37:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Yang Z" X-Patchwork-Id: 134616 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A46E1B6FA4 for ; Fri, 6 Jan 2012 18:38:14 +1100 (EST) Received: from localhost ([::1]:52263 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rj4NM-0005vD-2n for incoming@patchwork.ozlabs.org; Fri, 06 Jan 2012 02:38:08 -0500 Received: from eggs.gnu.org ([140.186.70.92]:38081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rj4Mt-0004Z0-Pg for qemu-devel@nongnu.org; Fri, 06 Jan 2012 02:37:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rj4Ms-0004oG-WF for qemu-devel@nongnu.org; Fri, 06 Jan 2012 02:37:39 -0500 Received: from mga01.intel.com ([192.55.52.88]:6684) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rj4Ms-0004nr-RX for qemu-devel@nongnu.org; Fri, 06 Jan 2012 02:37:38 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 05 Jan 2012 23:37:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.71,315,1320652800"; d="scan'208";a="109358957" Received: from pgsmsx602.gar.corp.intel.com ([10.221.43.81]) by fmsmga002.fm.intel.com with ESMTP; 05 Jan 2012 23:37:37 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by pgsmsx602.gar.corp.intel.com (10.221.43.81) with Microsoft SMTP Server (TLS) id 8.2.255.0; Fri, 6 Jan 2012 15:37:31 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.38]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.223]) with mapi id 14.01.0355.002; Fri, 6 Jan 2012 15:37:30 +0800 From: "Zhang, Yang Z" To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH 2/3] use gettimeofday() instead of time() Thread-Index: AczMRgnxwzcanBLNQmiTmKviZw+iqA== Date: Fri, 6 Jan 2012 07:37:29 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.88 Cc: "aliguori@us.ibm.com" , "Shan, Haitao" , "avi@redhat.com" , "kvm@vger.kernel.org" Subject: [Qemu-devel] [PATCH 2/3] use gettimeofday() instead of time() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org use gettimeofday() instead of time(). Please refer the patch zero for the description. Signed-off-by: Yang Zhang diff --git a/vl.c b/vl.c index 01c5a9d..9a51047 100644 --- a/vl.c +++ b/vl.c @@ -438,8 +438,11 @@ void qemu_get_timedate(struct tm *tm, int64_t offset) { time_t ti; struct tm *ret; + struct timeval tv; + + gettimeofday(&tv, NULL); + ti = tv.tv_sec; - time(&ti); ti += offset; if (rtc_date_offset == -1) { if (rtc_utc)