I am using this (yes, visually cr@ppy ;-)) code snippet to set back
the time 5 hours. hwclock tells me it worked fine but the terminal
windows opened before and after running hwclock still give me the
"old" time setting?
I am using this (yes, visually cr@ppy ;-)) code snippet to set back
the time 5 hours. hwclock tells me it worked fine but the terminal
windows opened before and after running hwclock still give me the
"old" time setting?
_HRS_PM=-5
###
# https://stackoverflow.com/questions/1092631/get-current-time-in-seconds-since-the-epoch-on-linux-bash
_DTS=$(date +%s)
echo "// __ \$_DTS: |${_DTS}|";
_DTF=$(date --date @${_DTS})
echo "// __ \$_DTF: |${_DTF}|";
_NEW_DTS=$((_DTS+3600*_HRS_PM))
echo "// __ \$_NEW_DTS: |${_NEW_DTS}|";
# Convert the number of seconds back to date
_NEW_DTF=$(date --date @${_NEW_DTS})
echo "// __ \$_NEW_DTF: |${_NEW_DTF}|";
which hwclock
sudo hwclock --show
sudo hwclock --debug --set --date "${_NEW_DTF}"
sudo hwclock --show
date
// __ $_DTS: |1679606975|
// __ $_DTF: |Thu 23 Mar 2023 09:29:35 PM UTC|
// __ $_NEW_DTS: |1679588975|
// __ $_NEW_DTF: |Thu 23 Mar 2023 04:29:35 PM UTC|
hwclock from util-linux 2.36.1
Thu 23 Mar 2023 09:29:35 PM UTC
$ sudo hwclock --show
2023-03-23 16:30:23.685781+00:00
$ date
Thu 23 Mar 2023 09:31:40 PM UTC
I am using this (yes, visually cr@ppy ;-)) code snippet to set back
the time 5 hours. hwclock tells me it worked fine but the terminal
windows opened before and after running hwclock still give me the
"old" time setting?
On 3/23/23, Albretch Mueller <lbrtchx@gmail.com> wrote:< snipped for brevity >
I am using this (yes, visually cr@ppy ;-)) code snippet to set back
the time 5 hours. hwclock tells me it worked fine but the terminal
windows opened before and after running hwclock still give me the
"old" time setting?
_HRS_PM=-5
just battled this topic a couple months ago but can't remember which operating system. It was fixed INSTANTLY by creating /etc/adjtime (if
it doesn't already exist) then entering the following:
0.0 0 0.0
0
UTC
Once saved, it takes just a few seconds then, BAM, there it is!
Everything matches.. IF the hardware clock is set to universal time.
I am using this (yes, visually cr@ppy ;-)) code snippet to set back
the time 5 hours. hwclock tells me it worked fine but the terminal
windows opened before and after running hwclock still give me the
"old" time setting?
As already pointed out, the hardware clock is used in very limited
ways and is not the same thing as the system clock, so your result
is as expected.
What are you actually trying to do?
What "time zone issues" do you refer to?
I should have pointed out that I always go into exposed mode (use the Internet) with a live DVD. My laptop was always 6 hours ahead and now
that they changed to summer time, it is 5 hours ahead.
If your policy choice ends up being "set HW clock to local", then you
also have to make sure the correct time zone is set on each operating
system, each time it boots. I have no idea how one does that on Debian
Live, since I've never used Debian Live. So, I can hope for your sake
that Debian Live uses a UTC HW clock.
If your policy choice ends up being "set HW clock to local", then you
also have to make sure the correct time zone is set on each operating system, each time it boots. I have no idea how one does that on Debian Live, since I've never used Debian Live. So, I can hope for your sake
that Debian Live uses a UTC HW clock.
You may also circumvent the problem by making sure your "online" OS is configured to set its time via NTP once it gets access to the Internet,
this way, any problem with the hwclock will only impact the "boot".
That works great for the Live OS, but not for the fixed-disk OS. If
the Live OS sets the HW clock to local upon shutdown, but the fixed-disk
OS expects the HW clock to be UTC, then the fixed-disk OS is wrong
every time it boots after the Live OS.
I am using right now a DELL laptop which had Windows 11 installed but
- Both Debian and Windows installed on the hard drive ...Thank you for the steps and the logical elucidations that may
BTW I've only really trusted reading or setting the RTC by means of
the CMOS screens, and treat it as a one-time only process (upon
acquisition), assuming the coin-cell battery never needs replacing.
That works great for the Live OS, but not for the fixed-disk OS. If
the Live OS sets the HW clock to local upon shutdown, but the fixed-disk
OS expects the HW clock to be UTC, then the fixed-disk OS is wrong
every time it boots after the Live OS.
AFAIK the Linux kernel is pretty careful not to change the *hour* of the hwclock: when using NTP, it will tweak the seconds to keep the hwclock
in sync with the rest of the world, but leave the hours alone, so as to preserve the timezone in use, regardless if it's the right one (UTC) or something else.
I assume GNU/Linux distributions like Debian are similarly careful,
since dual booting with a Windows install that doesn't use UTC for the hwclock was a very common use case at least some years ago.
On 3/24/23, Andy Smith <andy@strugglers.net> wrote:
As already pointed out, the hardware clock is used in very limited
ways and is not the same thing as the system clock, so your result
is as expected.
What are you actually trying to do?
What "time zone issues" do you refer to?
I should have pointed out that I always go into exposed mode (use the Internet) with a live DVD. My laptop was always 6 hours ahead and now
that they changed to summer time, it is 5 hours ahead.
I used logs which names a time a la:
_DT=$(date +%Y%m%d%H%M%S)
_BN=$(basename "${_SDIR}")
_LOG_FL="${_BN}_${_DT}.log"
...
If anything, timing is one of the aspects of reality which should be coordinated.
On 3/25/23, Max Nikulin wrote:
- Both Debian and Windows installed on the hard drive ...Thank you for the steps and the logical elucidations that may
certainly help someone else, but I can't do that "because" all
electronic devices which I use are being kept.
You can't physically alter a DVD[+|-]R once it is burned ...
You can't physically alter a DVD[+|-]R once it is burned ...
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 297 |
Nodes: | 16 (2 / 14) |
Uptime: | 30:41:22 |
Calls: | 6,669 |
Calls today: | 1 |
Files: | 12,216 |
Messages: | 5,338,100 |