When the hardware or system time is not editable due to module access control restrictions, the times are now displayed (but cannot be changed).
---- Changes since 1.340 ----
Added check for empty timeservers field.
+---- Changes since 1.380 ----
+Display a more complete message if unable to get the hardware time from hwclock.
# Get the hardware time
if ($config{'hwtime'}) {
local @tm = &get_hardware_time();
- @tm || &error($text{'index_eformat'});
+ @tm || &error($get_hardware_time_error || $text{'index_eformat'});
$hw_date{ 'second' } = $tm[0];
$hw_date{ 'minute' } = $tm[1];
$hw_date{ 'hour' } = $tm[2];
index_hardware2=Set hardware time too
index_tzheader=Time Zone
index_tz=Change timezone to
+index_ehwclock=$1 failed : $2
action_save=Save
action_apply=Apply
}
# get_hardware_time()
-# Returns the current hardware time, in localtime format
+# Returns the current hardware time, in localtime format. On failure returns
+# an empty array, and sets the global $get_hardware_time_error
sub get_hardware_time
{
local $flags = &get_hwclock_flags();
+$get_hardware_time_error = undef;
local $out = `hwclock $flags`;
if ($out =~ /^(\S+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+):(\d+)\s+(\d+)\s+/) {
return ($6, $5, $4, $3, &month_to_number($2), $7-1900, &weekday_to_number($1));
return ($7, $6, $5+($8 eq 'pm' ? 12 : 0), $2, &month_to_number($3), $4-1900, &weekday_to_number($1));
}
else {
+ $get_hardware_time_error = &text('index_ehwclock',
+ "<tt>".&html_escape("hwclock $flags")."</tt>",
+ "<pre>".&html_escape($out)."</pre>");
return ( );
}
}