Skip to content

Commit

Permalink
Revert "tzsetup: ask local/UTC question only on x86"
Browse files Browse the repository at this point in the history
I am unsure if AArch64 Windows systems keep UTC or local time in the RTC
by default, so keep tzsetup consistent across architectures for now.

This reverts commit aa6fb1d.

Reported by:	 Mark Millard

(cherry picked from commit c6030b3)
  • Loading branch information
emaste authored and bsdjhb committed Sep 7, 2024
1 parent 7a6bb1a commit e52eeb8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
1 change: 0 additions & 1 deletion usr.sbin/tzsetup/tzsetup.8
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ Skip the initial question about adjusting the clock if not set to UTC.
will neither create nor delete
.Pa /etc/wall_cmos_clock .
On a newly installed system, the hardware clock will keep UTC.
This option is enabled automatically on non-x86 hardware.
.El
.Pp
It is possible to short-circuit the menu system by specifying the
Expand Down
25 changes: 10 additions & 15 deletions usr.sbin/tzsetup/tzsetup.c
Original file line number Diff line number Diff line change
Expand Up @@ -826,28 +826,23 @@ main(int argc, char **argv)
char prompt[128];
int fd;
#endif
int c, rv;
bool skiputc;
char *dztpath;
#if defined(__i386__) || defined(__amd64__)
int c, rv, skiputc;
char vm_guest[16] = "";
size_t len = sizeof(vm_guest);
char *dztpath;

skiputc = false;

/* Default skiputc to true for VM guests */
if (sysctlbyname("kern.vm_guest", vm_guest, &len, NULL, 0) == 0 &&
strcmp(vm_guest, "none") != 0)
skiputc = true;
#else
skiputc = true;
#endif
dztpath = NULL;
skiputc = 0;

#ifdef HAVE_BSDDIALOG
setlocale(LC_ALL, "");
#endif

/* Default skiputc to 1 for VM guests */
if (sysctlbyname("kern.vm_guest", vm_guest, &len, NULL, 0) == 0 &&
strcmp(vm_guest, "none") != 0)
skiputc = 1;

while ((c = getopt(argc, argv, "C:d:nrs")) != -1) {
switch (c) {
case 'C':
Expand All @@ -866,7 +861,7 @@ main(int argc, char **argv)
#endif
break;
case 's':
skiputc = true;
skiputc = 1;
break;
default:
usage();
Expand Down Expand Up @@ -956,7 +951,7 @@ main(int argc, char **argv)
if (bsddialog_init() == BSDDIALOG_ERROR)
errx(1, "Error bsddialog: %s\n", bsddialog_geterror());

if (!skiputc) {
if (skiputc == 0) {
snprintf(prompt, sizeof(prompt),
"Is this machine's CMOS clock set to UTC? "
"If it is set to local time,\n"
Expand Down

0 comments on commit e52eeb8

Please sign in to comment.