From patchwork Thu Oct 11 12:23:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Pisarenko X-Patchwork-Id: 10636587 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4701916B1 for ; Thu, 11 Oct 2018 12:30:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39A0D2B434 for ; Thu, 11 Oct 2018 12:30:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DF372B43A; Thu, 11 Oct 2018 12:30:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A36AC2B434 for ; Thu, 11 Oct 2018 12:30:31 +0000 (UTC) Received: from localhost ([::1]:34147 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAa6p-0000wK-05 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 11 Oct 2018 08:30:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41464) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAa46-0007B1-Kx for qemu-devel@nongnu.org; Thu, 11 Oct 2018 08:27:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gAa42-00082d-Nj for qemu-devel@nongnu.org; Thu, 11 Oct 2018 08:27:42 -0400 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]:46837) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gAa42-00081X-AR for qemu-devel@nongnu.org; Thu, 11 Oct 2018 08:27:38 -0400 Received: by mail-lj1-x241.google.com with SMTP id x3-v6so8009684lji.13 for ; Thu, 11 Oct 2018 05:27:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=grwMuXdwxT2SR3m60LssPVc9MuHTUquDCMMf5rAv7NI=; b=jxf3zFsbYmF7EBIU6PDBtTRlAgvdgJ1gSt/phUPTb1THfaxOJihBreb8WioAWlvmfp PYJMUVazioYwl2KoNQcxWd/i2+U6TtNXrKxmWZrbIbeV6USKQmbwRMr8tvkb7Qgg6EJt SMn9NM56oIDFSu8NMQFAoOb/MM7TXQo3WH2YY3FsBk6i0WLKFUuKFu+NOHU3c/Fq438G B85pH2A2r7Q7L8HO1TvjQa2CchHSPso+Jwky5or+pHOgRNOZbcj1jitXFV2ZylIWFJ2b ppMBkHbRAke0uymsqgnqEoArQJxDumYj95xHap3B7mf7M/fjBCvJXTURqhF5+jNN9kxw 9RIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=grwMuXdwxT2SR3m60LssPVc9MuHTUquDCMMf5rAv7NI=; b=LKq6fDNjAWAgWWycG9j9HeN4R0J5lPNiYT9jG7XryQS8agHD3M/PBa+Lyq4YCNG+Y0 m5Q0TjmdlixXUCpNNVXEcc7svdveu6nLDSIvC+voTnNdnVgeXTX3dPzfviySIuAxgv3I z0LFrrYK4RHxEFJt0QOAeNYP/a+KxbGeCgERu4mbmAeBGswVXrHyFBV8KVjGCx/LLfSd I09M4GFmz6ufhzE+xwjt6eKOqodYMuXmb+eR5exoKInw4OxfPjGxdzijV0xKKwHHRyYk LaPahvzUCkNlgPuXIRNo3zmj2YbWXPKpgSp3yN4U/NMFwskDfEBhq41raDtUjF3TDE0O PORw== X-Gm-Message-State: ABuFfojqtY9fLYIWdX1n8qxRusQTPqLa6R9sAZp6/nmBZMsMq4hp3htn JbjQcbEFAv6bYhAIYd1SXH6bPseE X-Google-Smtp-Source: ACcGV62xCS58SXIiFbkpkc2+u1jU4uYXdvWuTDxx8mNOy485edx1JUR+aYxTu4X6nNBwECwzkEY4EQ== X-Received: by 2002:a2e:651d:: with SMTP id z29-v6mr1174991ljb.36.1539260856594; Thu, 11 Oct 2018 05:27:36 -0700 (PDT) Received: from localhost.localdomain ([77.221.221.49]) by smtp.gmail.com with ESMTPSA id 33-v6sm5713890lfu.64.2018.10.11.05.27.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Oct 2018 05:27:35 -0700 (PDT) From: Artem Pisarenko To: qemu-devel@nongnu.org Date: Thu, 11 Oct 2018 18:23:19 +0600 Message-Id: <27268f8d488b4ec134a4475139bf0b50459cbf96.1539259394.git.artem.k.pisarenko@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::241 Subject: [Qemu-devel] [PATCH 4/4] vl, qapi: offset value calculation in RTC_CHANGE event reverted to match behavior before #1797033 bugfix and documented X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Artem Pisarenko , Markus Armbruster , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Return value of qemu_timedate_diff(), used for calculation offset in QAPI 'RTC_CHANGE' event restored to keep compatibility, although it isn't documented that difference is relative to host clock advancement. Added important note to 'RTC_CHANGE' event description to highlight established implementation specifics. Signed-off-by: Artem Pisarenko --- qapi/misc.json | 3 ++- vl.c | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/qapi/misc.json b/qapi/misc.json index ada9af5..ed866f2 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -3070,7 +3070,8 @@ # Emitted when the guest changes the RTC time. # # @offset: offset between base RTC clock (as specified by -rtc base), and -# new RTC clock value +# new RTC clock value. Note that value will be different depending +# on clock choosen to drive RTC (specified by -rtc clock). # # Note: This event is rate-limited. # diff --git a/vl.c b/vl.c index d60018f..72a4173 100644 --- a/vl.c +++ b/vl.c @@ -788,10 +788,10 @@ void qemu_system_vmstop_request(RunState state) /***********************************************************/ /* RTC reference time/date access */ -static time_t qemu_ref_timedate(void) +static time_t qemu_ref_timedate(QEMUClockType clock) { - time_t value = qemu_clock_get_ms(rtc_clock) / 1000; - switch (rtc_clock) { + time_t value = qemu_clock_get_ms(clock) / 1000; + switch (clock) { case QEMU_CLOCK_REALTIME: value -= rtc_realtime_clock_offset; /* no break */ @@ -811,7 +811,7 @@ static time_t qemu_ref_timedate(void) void qemu_get_timedate(struct tm *tm, int offset) { - time_t ti = qemu_ref_timedate(); + time_t ti = qemu_ref_timedate(rtc_clock); ti += offset; @@ -844,7 +844,7 @@ int qemu_timedate_diff(struct tm *tm) } } - return seconds - qemu_ref_timedate(); + return seconds - qemu_ref_timedate(QEMU_CLOCK_HOST); } static void configure_rtc_base_datetime(const char *startdate)