mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 16:21:39 +00:00
cleaned up units in weather
This commit is contained in:
parent
5ea6a66474
commit
04d08bdc4c
10
inxi
10
inxi
|
@ -13897,7 +13897,7 @@ sub wind_output {
|
|||
$gust_mph = undef if $gust_mph && $mph && $mph eq $gust_mph;
|
||||
$gust_ms = undef if $gust_ms && $ms && $ms eq $gust_ms;
|
||||
# calculate and round, order matters so that rounding only happens after math done
|
||||
$ms = 0.44704 * $mph if $mph && !$ms;
|
||||
$ms = sprintf("%.1f", $ms ) if $ms; # very low mph speeds yield 0, which is wrong
|
||||
$mph = $ms * 2.23694 if $ms && !$mph;
|
||||
$kmh = sprintf("%.0f", 18 * $ms / 5) if $ms;
|
||||
$ms = sprintf("%.0f", $ms ) if $ms;
|
||||
|
@ -13913,10 +13913,10 @@ sub wind_output {
|
|||
}
|
||||
elsif ($mph && $direction ){
|
||||
if ( $weather_unit eq 'cf' ){
|
||||
$result = "from $direction at $ms $m_unit ($kmh $km_unit; $mph $i_unit)";
|
||||
$result = "from $direction at $ms $m_unit ($kmh $km_unit, $mph $i_unit)";
|
||||
}
|
||||
elsif ( $weather_unit eq 'fc' ){
|
||||
$result = "from $direction at $mph $i_unit ($ms $m_unit; $kmh $km_unit)";
|
||||
$result = "from $direction at $mph $i_unit ($ms $m_unit, $kmh $km_unit)";
|
||||
}
|
||||
elsif ( $weather_unit eq 'c' ){
|
||||
$result = "from $direction at $ms $m_unit ($kmh $km_unit)";
|
||||
|
@ -13926,10 +13926,10 @@ sub wind_output {
|
|||
}
|
||||
if ($gust_mph){
|
||||
if ( $weather_unit eq 'cf' ){
|
||||
$result .= ". Gusting to $ms $m_unit ($kmh $km_unit; $mph $i_unit)";
|
||||
$result .= ". Gusting to $ms $m_unit ($kmh $km_unit, $mph $i_unit)";
|
||||
}
|
||||
elsif ( $weather_unit eq 'fc' ){
|
||||
$result .= ". Gusting to $mph $i_unit ($ms $m_unit; $kmh $km_unit)";
|
||||
$result .= ". Gusting to $mph $i_unit ($ms $m_unit, $kmh $km_unit)";
|
||||
}
|
||||
elsif ( $weather_unit eq 'c' ){
|
||||
$result .= ". Gusting to $ms $m_unit ($kmh $km_unit)";
|
||||
|
|
Loading…
Reference in a new issue