From: Julian Gilbey Date: Sat, 7 Jul 2012 02:07:39 +0000 (+1200) Subject: Change the DateCalc mode to resolve showing negative times for the next recording. X-Git-Tag: debian-sid-0.10.2-1~11 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a2bd75784cd7449c0ef3fd8c2020d02a319a9c97;p=mythtv-status.git Change the DateCalc mode to resolve showing negative times for the next recording. Julian's bug report: Hello Andrew! I noticed a bizarre behaviour of mythtv-status: at 9pm, when the next recording was due at about 6pm the next day, it reported: "Next Recording In: -3 Hours, -7 Minutes", which is clearly nonsense. The attached patch fixes this, and two other bugs: - if the next recording is in longer than 1 day, it now gives the correct time - if the time is 1 Hour, 1 Minute, it says this correctly (instead of saying 1 Hour, 1 Minutes) --- diff --git a/bin/mythtv-status b/bin/mythtv-status index c63394d..80e5336 100755 --- a/bin/mythtv-status +++ b/bin/mythtv-status @@ -439,11 +439,11 @@ my @blocks = ( if $next_time eq 'Never' || $next_time eq 'now'; my $err; - my $delta = DateCalc('now', $next_time, \$err, 1); + my $delta = DateCalc('now', $next_time, \$err, 0); my $str = Delta_Format($delta, 0, '%hh Hours, %mv Minutes'); - my $seconds = Delta_Format($delta, 0, '%sh'); + my $seconds = Delta_Format($delta, 'approx', 0, '%sh'); - $str =~ s/\b1 (Hour|Minute)s/1 $1/; + $str =~ s/\b1 (Hour|Minute)s/1 $1/g; $str =~ s/^0 Hours, //; $str =~ s/ 0 Minutes//;