From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:4864:20::530; helo=mail-ed1-x530.google.com; envelope-from=pete@akeo.ie; receiver=edk2-devel@lists.01.org Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 405A5211CD9B7 for ; Mon, 25 Feb 2019 15:52:16 -0800 (PST) Received: by mail-ed1-x530.google.com with SMTP id b20so9158391edw.11 for ; Mon, 25 Feb 2019 15:52:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=XI1Hku9AjuQOtOYd+I/1bzwvaXR6kESA1iLkZcu9Mz0=; b=LtIp3fUidQ7VNiyV9XR15orkNPuWtOPmEIgJKawYxtN+GLnQG5Mpl7DhLdr55NwrVD mb/kvDcw97Du/FOX4jbMzg9Io9B9cXLy7Pm/IQFNKzk77Cb5+BET+qCb6YFqIA8nsefh ZPGI/evL+sBcZ19W8wQeKhZaLSV7UxVIbAc62PGQ1DaEfjqEyl8zaiPUrkd7qQ3+Eruw 720tzZmt3SRyoAlgWLKJpWFvP9B2/siINK3MFXZ00waKP8P+reuH7GoUA5X0uBPxJFGS nx77/ITFrJBBVvAkM5/+ZsQlGkg4qifmiPYWkljWL/mEeHBlAegqB6BNT7oTl2ou6KEl ad9A== 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; bh=XI1Hku9AjuQOtOYd+I/1bzwvaXR6kESA1iLkZcu9Mz0=; b=CHmDRm7A0S+fQfFRZ8AMmNAg2BSzTD69GI2r8Er7lk9yUB+IElHrNdcq27WHSS/ilA f/y8Cg/NfTf4eBMOIs4r3GGl8yzBpoWuqqgoLEauW8UTxocfClCThQQFYubi6UdSviYR xR7Re2Y6kcKgreNzFz7PRHK+E9PNR2H3g33F+HZBntHKRDqBHZV4mz7SCIdWZc8saidR Nvav5YOET9PfvjF+/ajeagmuyZB41MCNUBqWF7o6LGDBSyR036UMPOpGvR751qitTHju aItiBIoi5eu06PgUWM2sw6g7o4skMBhMrYypFAuXp79tceBuXxVjQ5phk1mavAZToRbm ICMw== X-Gm-Message-State: AHQUAuY5JJHySENKlXYrN213fkKYr0Kwiq15UPB27DwpLFtPVNvH9UPd DuupMItmBqtJv4rVr/IOEXOIRiCnWsc= X-Google-Smtp-Source: AHgI3IafXdD7WOJELd1eUbyjIzFNb+heva4qMlQUp3t7vqIeJpbKviUawfc4JHT33XM63ZxrBZc1Xg== X-Received: by 2002:a17:906:940d:: with SMTP id q13mr13388604ejx.160.1551138734358; Mon, 25 Feb 2019 15:52:14 -0800 (PST) Received: from localhost.localdomain ([84.203.58.139]) by smtp.gmail.com with ESMTPSA id p47sm3006001eda.31.2019.02.25.15.52.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Feb 2019 15:52:13 -0800 (PST) From: Pete Batard To: edk2-devel@lists.01.org Date: Mon, 25 Feb 2019 23:52:01 +0000 Message-Id: <20190225235202.2252-1-pete@akeo.ie> X-Mailer: git-send-email 2.17.0.windows.1 Subject: [PATCH 0/1] EmbeddedPkg: Fix multiple Virtual RTC issues X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 X-List-Received-Date: Mon, 25 Feb 2019 23:52:17 -0000 This patch fixes multiple issues in VirtualRealTimeClockLib.c: 1. Use of two separate variables (ElapsedSeconds and EpochSeconds) in LibGetTime(), where only a single one should have been used. 2. Possible underflow while sustracting TZ/DST offsets in LibSetTime() if the user sets a date that is very close to start of epoch. 3. Non substraction of elpased seconds since reset, which would lead to the following behaviour in UEFI shell (assuming for this example that exactly 5 minutes have elapsed since platform reset): Shell> time 12:00:00 Shell> time 12:05:01 (LOCAL) In other words, setting and immediately reading back the time would result in the returned value being offset by the time since reset. This last behaviour has been observed (and confirmed fixed) using an RPi3 platform. Regards, /Pete Pete Batard (1): EmbeddedPkg: Fix multiple Virtual RTC issues .../VirtualRealTimeClockLib.c | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) -- 2.17.0.windows.1