Util-Linux Archive on lore.kernel.org
 help / color / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Cc: util-linux@vger.kernel.org,
	Linux List Kernel Mailing <linux-kernel@vger.kernel.org>,
	linux-rtc@vger.kernel.org
Subject: Re: [bugreport] "hwclock -w" reset time instead of setting the right time
Date: Thu, 2 Jan 2020 14:14:34 +0100
Message-ID: <20200102131434.tky2hquki23laqqo@10.255.255.10> (raw)
In-Reply-To: <CABXGCsNkm3VuzO60WBCi4VJmDnO=DmprQ1P=dd0FcW2-+dGc0w@mail.gmail.com>

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  <kzak@redhat.com>
 http://karelzak.blogspot.com


  reply index

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CABXGCsODr3tMpQxJ_nhWQQg5WGakFt4Yu5B8ev6ErOkc+zv9kA@mail.gmail.com>
     [not found] ` <20200101141748.GA191637@mit.edu>
     [not found]   ` <CABXGCsOv26W6aqB5WPMe-mEynmwy55DTfTeL5Dg9vRq6+Y6WvA@mail.gmail.com>
2020-01-02  8:08     ` Mikhail Gavrilov
2020-01-02 11:08       ` Karel Zak
2020-01-02 11:55         ` Mikhail Gavrilov
2020-01-02 13:14           ` Karel Zak [this message]
2020-01-02 15:00             ` Mikhail Gavrilov
2020-01-02 16:58               ` J William Piggott
2020-01-02 17:17                 ` Mikhail Gavrilov
2020-01-03 10:02                   ` Alexandre Belloni
2020-01-03 10:11                     ` Mikhail Gavrilov
2020-01-03 10:19                       ` Alexandre Belloni
2020-01-03 14:22                         ` Mikhail Gavrilov
2020-01-04  5:44                           ` Jinke Fan
2020-01-04  8:25                             ` Mikhail Gavrilov
2020-01-04 11:35                               ` Jinke Fan
2020-01-04 12:23                                 ` Mikhail Gavrilov

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200102131434.tky2hquki23laqqo@10.255.255.10 \
    --to=kzak@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=mikhail.v.gavrilov@gmail.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Util-Linux Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/util-linux/0 util-linux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 util-linux util-linux/ https://lore.kernel.org/util-linux \
		util-linux@vger.kernel.org
	public-inbox-index util-linux

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.util-linux


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git