From patchwork Wed Oct 17 12:23:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Pisarenko X-Patchwork-Id: 10645401 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 AB09F13B0 for ; Wed, 17 Oct 2018 12:28:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CC1D271FD for ; Wed, 17 Oct 2018 12:28:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BFA1285A5; Wed, 17 Oct 2018 12:28:38 +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 2EF08282EC for ; Wed, 17 Oct 2018 12:28:38 +0000 (UTC) Received: from localhost ([::1]:36347 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCkwH-0005Je-FG for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Oct 2018 08:28:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCksj-0002dY-2x for qemu-devel@nongnu.org; Wed, 17 Oct 2018 08:24:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCksg-0007C1-6k for qemu-devel@nongnu.org; Wed, 17 Oct 2018 08:24:56 -0400 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]:44703) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gCksf-00079h-VF for qemu-devel@nongnu.org; Wed, 17 Oct 2018 08:24:54 -0400 Received: by mail-lj1-x242.google.com with SMTP id v6-v6so24105813ljc.11 for ; Wed, 17 Oct 2018 05:24:53 -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=0IysXCiBWRfOiFIJKC2Hz4a4JgGaqRoCw413cn6G+RY=; b=R2lwDyQkTHX89lJ5B7besPxWj9eR2lsXuRXyoXwu2P8fVG2QW5IqqpbvOROiLNeXrF WcU7XjuDHQYaFPvMviwVpnK2V80fEI0x4iK7RPBbf+W572GoYRNpB8x50nhxMfuNmcJu LB+Ru8+QuWxrOkz370czlg4jQy0a0xOZeYzCkWI9XOE3LlA6MqwY4p8BR/PQhicXq64N S2xs2K5L0W+0cAxgXRy36Rkl35+3TplBJQAL/AAD2nspSxhBCSlZ+HN6luFMV69O1kl7 Oud3iERbptJZPZcIgXu0Z0pL7rI8nDUYslc8upa9mly4ofw7xbKyw/GW70FeK0YiwsFG gSTQ== 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=0IysXCiBWRfOiFIJKC2Hz4a4JgGaqRoCw413cn6G+RY=; b=bIDAEPqSWnicCsoyfji2bw0Wn8ZkyT+95f7JrTgL+2BQpUJlwEwcQ4oqTJzGHKzsWi DlAc6a7ZDM6PjyR9l3eXWWbQzjIA5cmNmuNWrFGy+qJq99wUZ4/92grH50Y/tlqYpOOc vQg+XYVlQXkVQjZXNZ3M+IbuLrOZmt4T1w/v4CIGN6vqVbm8VB+FyWKYVT91wflKDe86 shFMRT++EoJGGMvpCNSvh17Rw//MoJCOlO3hpwOMSmEyYlpYNDQuS5eWU3hlfOtOtd5C 5vrsLQbg0kSrUYw/+gAG0qLqfSUEn1/7ad5F6lHPJmVgKTUfc3/vIqqbF5z5yAeoSHGd Qy6g== X-Gm-Message-State: ABuFfoglxhggMTkE56KFGSc3s6w80QytplnPELRdKFaHyQOfSZFCL6lC 86ts2Vrwp5ftUyVcRjCu/jJpm2WnQeU= X-Google-Smtp-Source: ACcGV63CwGje1N94jglx1EC5knKbR1tJ6mcOD1KvfvZCGwNtirf1pMoSaTREbJ/bk5webjsq1GP6FA== X-Received: by 2002:a2e:59db:: with SMTP id g88-v6mr17161399ljf.79.1539779092284; Wed, 17 Oct 2018 05:24:52 -0700 (PDT) Received: from localhost.localdomain ([77.221.221.49]) by smtp.gmail.com with ESMTPSA id z67-v6sm3704118lfa.14.2018.10.17.05.24.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Oct 2018 05:24:51 -0700 (PDT) From: Artem Pisarenko To: qemu-devel@nongnu.org Date: Wed, 17 Oct 2018 18:23:03 +0600 Message-Id: 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::242 Subject: [Qemu-devel] [PATCH v2 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 78a8a68..c350aba 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; @@ -849,7 +849,7 @@ int qemu_timedate_diff(struct tm *tm) break; } - return seconds - qemu_ref_timedate(); + return seconds - qemu_ref_timedate(QEMU_CLOCK_HOST); } static void configure_rtc_base_datetime(const char *startdate)