Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17423606ybl; Thu, 2 Jan 2020 05:15:41 -0800 (PST) X-Google-Smtp-Source: APXvYqwXlLalvalf4Hx5iGz0gKTNZZik+nOJ/1rOU/ncJNp7X58FXzjwEGblopZkefsaE4PEGTFS X-Received: by 2002:a05:6830:3001:: with SMTP id a1mr78159164otn.254.1577970941582; Thu, 02 Jan 2020 05:15:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577970941; cv=none; d=google.com; s=arc-20160816; b=KaHgoF1r1ohmAHVYWb2rKQYlg8MonJy1kk9+QmkZs7UHYKmTiCaEqGgyqLQiZSinUk /m25sa4T+2ss3Pdy894Dq61B/jpdKWTEXGCFQPRD2f74eUqBrA4x7VzEKOIqETo83j2n Z/Vp6HL6EkOk6mDp2lNQtdvU83kwgjWlPXh5xSfK/DRoL6V//EGHZNlHgsUBlDcBT0Yj 8XAZtbj54PSzi76jPs/Dc7UvTedCEtHzePf/7Ox4OLP2mbibOCNDZ7VICmdpPU8bMvls RbhXY9Md9JK1LWjSdEq11OGqBo5nZDgk7CLGhevGrKfVrBwqJ2GSs2MmQlfW/wWBbBES mGXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=eICqUZWHS7swGBDV3nYGnBDUTKdhLfVD0+54z2FAMDU=; b=PwmZzS5Lj7Hd/Vbq9TZRBL+k3SzsZwTFqZIvEP2iaGXd5bjIiCjdxHjAGXa/c6Qk6r 85ShdTY451XiuF6rRgxP4dWZAfbxInLI3B7/34V29Jtgg+21n+rNT+ZyMbmxC6P5AlTZ 2/4RV2hvunz/ME1Kn4CCJQuhLvg6lvTJD97sjatdVUDAFpEAxTdW+KuEjViBsb152SJC 0TpnIQQ9bB97C9WicZs83NeVdIq5PkNlmOdn9xwaFd/V/2mGviOK90BWUKYftrUgD0eg fMkFMVnE5L9yY7d9HPDvxasYZ0y3Zw/ndpvXwh/1SHBlIQdErgbTwsJx6Mdl4Awf2ZQT aXaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XsxUF7hz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z16si29188442otk.80.2020.01.02.05.15.29; Thu, 02 Jan 2020 05:15:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XsxUF7hz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728341AbgABNOm (ORCPT + 99 others); Thu, 2 Jan 2020 08:14:42 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:29304 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728165AbgABNOm (ORCPT ); Thu, 2 Jan 2020 08:14:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577970880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eICqUZWHS7swGBDV3nYGnBDUTKdhLfVD0+54z2FAMDU=; b=XsxUF7hzJkR1IYitDjZ1c1sy3qZ3XL7T4lXrXVeYVDYVT0QbDvFKNcGaEssS0pnPCzG6Np N49n/DNjISjF3s6a4i77n0Xw0RcMSBg7rG2epoicCGF7TsNpreaqYTeErBn8omnSJgv5L+ c09lL7O7JQdPB9i6eB7zdi69P1nLHkg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-408-ro_Lx_qPM8CH5w8VCS-2AA-1; Thu, 02 Jan 2020 08:14:39 -0500 X-MC-Unique: ro_Lx_qPM8CH5w8VCS-2AA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 914A7593A0; Thu, 2 Jan 2020 13:14:38 +0000 (UTC) Received: from 10.255.255.10 (ovpn-204-196.brq.redhat.com [10.40.204.196]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 732A860BF4; Thu, 2 Jan 2020 13:14:37 +0000 (UTC) Date: Thu, 2 Jan 2020 14:14:34 +0100 From: Karel Zak To: Mikhail Gavrilov Cc: util-linux@vger.kernel.org, Linux List Kernel Mailing , linux-rtc@vger.kernel.org Subject: Re: [bugreport] "hwclock -w" reset time instead of setting the right time Message-ID: <20200102131434.tky2hquki23laqqo@10.255.255.10> References: <20200101141748.GA191637@mit.edu> <20200102110817.ahqaqidw3ztw3kax@10.255.255.10> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 02, 2020 at 04:55:32PM +0500, Mikhail Gavrilov wrote: > # hwclock -w -v > hwclock from util-linux 2.35-rc1-20-63f8 > System Time: 1577964536.796672 > Trying to open: /dev/rtc0 > Using the rtc interface to the clock. > Last drift adjustment done at 1577950892 seconds after 1969 > Last calibration done at 1577950892 seconds after 1969 > Hardware clock is on UTC time > Assuming hardware clock is kept in UTC time. > RTC type: 'rtc_cmos' > Using delay: 0.500000 seconds > missed it - 1577964536.797135 is too far past 1577964536.500000 > (0.297135 > 0.001000) > 1577964537.500000 is close enough to 1577964537.500000 (0.000000 < 0.002000) > Set RTC to 1577964537 (1577964536 + 1; refsystime = 1577964536.000000) > Setting Hardware Clock to 11:28:57 = 1577964537 seconds since 1969 > ioctl(RTC_SET_TIME) was successful. > Not adjusting drift factor because the --update-drift option was not used. > New /etc/adjtime data: > 0.000000 1577964536 0.000000 > 1577964536 > UTC At first glance it seems hwclock works as expected, I do not see anything wrong in the output. > Demonstration: https://youtu.be/Yx27IH2opEc What is hw time before reboot? Can you verify that hwclock reset the clock? (or is it system reboot?) # hwclock -w -v # hwclock -v Do you see anything interesting in dmesg output before reboot and after hwclock -w? (CC: to linux-rtc@vger.kernel.org). Karel -- Karel Zak http://karelzak.blogspot.com