Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #256312
| From | Albretch Mueller <lbrtchx@gmail.com> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | differences between hwclock <-> date due to time zone issues? ... |
| Date | 2023-03-23 22:50 +0100 |
| Message-ID | <GcAYN-eBEG-1@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
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
Back to linux.debian.user | Previous | Next — Next in thread | Find similar | Unroll thread
differences between hwclock <-> date due to time zone issues? ... Albretch Mueller <lbrtchx@gmail.com> - 2023-03-23 22:50 +0100
Re: differences between hwclock <-> date due to time zone issues? ... Stefan Monnier <monnier@iro.umontreal.ca> - 2023-03-23 23:10 +0100
Re: differences between hwclock <-> date due to time zone issues? ... Cindy Sue Causey <butterflybytes@gmail.com> - 2023-03-23 23:10 +0100
Re: differences between hwclock <-> date due to time zone issues? ... Cindy Sue Causey <butterflybytes@gmail.com> - 2023-03-23 23:30 +0100
Re: differences between hwclock <-> date due to time zone issues? ... David Wright <deblis@lionunicorn.co.uk> - 2023-03-23 23:50 +0100
Re: differences between hwclock <-> date due to time zone issues? ... Andy Smith <andy@strugglers.net> - 2023-03-24 15:50 +0100
Re: differences between hwclock <-> date due to time zone issues? ... Albretch Mueller <lbrtchx@gmail.com> - 2023-03-24 18:20 +0100
Re: differences between hwclock <-> date due to time zone issues? ... Greg Wooledge <greg@wooledge.org> - 2023-03-24 22:50 +0100
Re: differences between hwclock <-> date due to time zone issues? ... Stefan Monnier <monnier@iro.umontreal.ca> - 2023-03-24 23:00 +0100
Re: differences between hwclock <-> date due to time zone issues? ... Greg Wooledge <greg@wooledge.org> - 2023-03-24 23:10 +0100
Re: differences between hwclock <-> date due to time zone issues? ... Stefan Monnier <monnier@iro.umontreal.ca> - 2023-03-25 00:20 +0100
Re: differences between hwclock <-> date due to time zone issues? ... Albretch Mueller <lbrtchx@gmail.com> - 2023-03-25 01:10 +0100
Re: differences between hwclock <-> date due to time zone issues? ... Max Nikulin <manikulin@gmail.com> - 2023-03-25 04:20 +0100
Re: differences between hwclock <-> date due to time zone issues? ... Albretch Mueller <lbrtchx@gmail.com> - 2023-03-25 04:50 +0100
Re: differences between hwclock <-> date due to time zone issues? ... Max Nikulin <manikulin@gmail.com> - 2023-03-25 06:00 +0100
Re: differences between hwclock <-> date due to time zone issues? ... Max Nikulin <manikulin@gmail.com> - 2023-03-25 09:00 +0100
Re: differences between hwclock <-> date due to time zone issues? ... David Wright <deblis@lionunicorn.co.uk> - 2023-03-25 05:30 +0100
Re: differences between hwclock <-> date due to time zone issues? ... David Wright <deblis@lionunicorn.co.uk> - 2023-03-25 05:30 +0100
Re: differences between hwclock <-> date due to time zone issues? ... Felix Miata <mrmazda@earthlink.net> - 2023-03-25 05:50 +0100
csiph-web