Repository navigation
Add a UTC hardware clock checkbox to the timezone page - #89
Conversation
The timezone page picked a zone but never said whether the hardware clock keeps UTC or local time, so the installed system fell back to whatever the live image shipped, which was local time. On a machine whose RTC keeps UTC the clock was then off by one UTC offset, and tzsetup was the only way to correct it after the install. Add a checkbox, checked by default, that writes utcClock=yes or no for pc-sysinstall. It is written to the config whether or not a timezone was picked, so the installed system always gets an explicit answer instead of inheriting one from the image. Resolves: ghostbsd/issues#390
Reviewer's GuideAdds a default-checked timezone-page option for indicating whether the hardware clock uses UTC, persists that choice, and always generates an explicit utcClock setting for pc-sysinstall to prevent the installed system from inheriting the live image’s local-time default. Sequence diagram for persisting the hardware clock settingsequenceDiagram
participant User
participant TimezonePage
participant TempConfig
participant CreateConfig
participant PcSysinstall
User->>TimezonePage: set utc_check
User->>TimezonePage: save_selection()
TimezonePage->>TempConfig: write utc_clock yes or no
CreateConfig->>TempConfig: read utc_clock
CreateConfig->>CreateConfig: write utcClock=yes or no
CreateConfig->>PcSysinstall: provide generated configuration
Flow diagram for the default UTC hardware clock optionflowchart TD
A[Open timezone page] --> B[Hardware clock uses UTC checkbox]
B --> C[Checked by default]
C --> D{User saves selection}
D -->|Checked| E[Persist utc_clock=yes]
D -->|Unchecked| F[Persist utc_clock=no]
E --> G[Generate explicit utcClock=yes]
F --> H[Generate explicit utcClock=no]
G --> I[Installed system uses UTC hardware clock setting]
H --> I
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/timezone.py" line_range="72-79" />
<code_context>
time_file = open(time, 'w')
time_file.writelines(timezone)
time_file.close()
+ # no makes pc-sysinstall write /etc/wall_cmos_clock on the install
+ utc_file = open(utc_clock, 'w')
+ utc_file.write('yes' if self.utc_check.get_active() else 'no')
+ utc_file.close()
return
def __init__(self, button3):
</code_context>
<issue_to_address>
**issue (bug_risk):** When `save_selection()` is called without a continent and city selection, constructing `timezone` raises `AttributeError` before `utc_file` is opened, so no UTC-clock value is written despite the new requirement that it always be persisted.
**Triggers:** When the timezone tree has no selected continent or city.
**Suggested fix:** Write the UTC setting before constructing the timezone path, or guard missing timezone selections while still writing `yes` or `no` to `utc_clock`.
```suggestion
def save_selection(self):
# no makes pc-sysinstall write /etc/wall_cmos_clock on the install
utc_file = open(utc_clock, 'w')
utc_file.write('yes' if self.utc_check.get_active() else 'no')
utc_file.close()
timezone = '%s/%s' % (self.continent, self.city)
time_file = open(time, 'w')
time_file.writelines(timezone)
time_file.close()
return
```
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and a wrong checkbox writes an incorrect utcClock setting into the installer configuration, which can make the installed system interpret the hardware clock incorrectly and cause time shifts, especially on dual-boot machines. Reverting the change will not fix systems already installed, but the setting and resulting clock configuration are bounded and repairable.
Blocking findings: src/timezone.py:79
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
The timezone page picked a zone but never said whether the hardware clock keeps UTC or local time, so the installed system fell back to whatever the live image shipped, which was local time. On a machine whose RTC keeps UTC the clock was then off by one UTC offset, and tzsetup was the only way to correct it after the install.
Add a checkbox, checked by default, that writes utcClock=yes or no for pc-sysinstall. It is written to the config whether or not a timezone was picked, so the installed system always gets an explicit answer instead of inheriting one from the image.
Resolves: ghostbsd/issues#390
Summary by Sourcery
Persist the hardware clock's UTC preference during installation so timezone configuration remains correct across systems and dual-boot setups.
New Features:
Bug Fixes:
Chores: