LFCS · Question #566
On a dual boot system, every time the system is booted back into Linux the time has been set backward by two hours. Which of the following commands will correct the problem so it will not occur again?
The correct answer is C. hwclock --hctosys --localtime. To correct a persistent time discrepancy in a dual-boot Linux system where the time is set backward, the hwclock --hctosys --localtime command should be used.
Question
Options
- Antpdate pool.ntp.org
- Bdate -d 'two hours'
- Chwclock --hctosys --localtime
- Dtime hwclock
How the community answered
(44 responses)- A2% (1)
- B5% (2)
- C84% (37)
- D9% (4)
Why each option
To correct a persistent time discrepancy in a dual-boot Linux system where the time is set backward, the `hwclock --hctosys --localtime` command should be used.
`ntpdate pool.ntp.org` synchronizes the system time with an NTP server once, but it does not change how Linux interprets the hardware clock for subsequent boots.
`date -d 'two hours'` would display the date two hours from now, or with appropriate syntax, adjust the system time temporarily, but this does not address the underlying hardware clock interpretation issue for future boots.
The `hwclock --hctosys --localtime` command instructs the Linux system to set its system time from the hardware clock (RTC) and to interpret the hardware clock's time as local time, rather than UTC. This is essential for dual-boot systems because Windows typically keeps the hardware clock set to local time, while Linux distributions often default to UTC, causing time inconsistencies when switching operating systems.
`time hwclock` measures the execution time of the `hwclock` command itself and does not modify any time settings or system configurations.
Concept tested: Hardware clock synchronization in dual-boot systems
Source: https://manpages.debian.org/testing/util-linux/hwclock.8.en.html
Topics
Community Discussion
No community discussion yet for this question.