Эх сурвалжийг харах

Always use ceil() -- we want an int() and we would like it to not be 0

Zachary Kotlarek 13 жил өмнө
parent
commit
70e4d2ea66

+ 4 - 1
dmx/projectorPower.pl

@@ -244,12 +244,15 @@ sub sayShutdown($) {
 
 
 	# Determine the unit
 	# Determine the unit
 	my $unit     = 'minute';
 	my $unit     = 'minute';
-	my $timeLeft = ceil($minutesLeft);
+	my $timeLeft = $minutesLeft;
 	if ($minutesLeft < 1) {
 	if ($minutesLeft < 1) {
 		$timeLeft = $minutesLeft * 60;
 		$timeLeft = $minutesLeft * 60;
 		$unit     = 'second';
 		$unit     = 'second';
 	}
 	}
 
 
+	# Avoid saying "0" unless we *really* mean it
+	$timeLeft = ceil($timeLeft);
+
 	# Add an "s" as needed
 	# Add an "s" as needed
 	my $plural = 's';
 	my $plural = 's';
 	if ($timeLeft == 1) {
 	if ($timeLeft == 1) {