diff --git a/lib/DDG/Goodie/UnixTime.pm b/lib/DDG/Goodie/UnixTime.pm index 93cee63d6..177f8f11c 100644 --- a/lib/DDG/Goodie/UnixTime.pm +++ b/lib/DDG/Goodie/UnixTime.pm @@ -20,9 +20,9 @@ category 'calculations'; topics 'sysadmin'; handle remainder => sub { + return unless defined $_; my $time_input = shift; - $time_input = time if ($time_input eq ''); # Default to 'now' when empty. my $time_utc; eval { $time_input = int(length($time_input) >= 13 ? ($time_input / 1000) : ($time_input + 0)); diff --git a/t/UnixTime.t b/t/UnixTime.t index 007703ecd..1bdb58aed 100644 --- a/t/UnixTime.t +++ b/t/UnixTime.t @@ -15,9 +15,9 @@ ddg_goodie_test([qw( 'unix time 0000000000000' => test_zci('Unix Time: Thu Jan 01 00:00:00 1970 +0000'), 'epoch 0' => test_zci('Unix Time: Thu Jan 01 00:00:00 1970 +0000'), 'epoch 2147483647' => test_zci('Unix Time: Tue Jan 19 03:14:07 2038 +0000'), - 'epoch' => test_zci(qr/Unix Time: [^\+]+\+0000/), # Now in UTC. - 'timestamp' => test_zci(qr/Unix Time: [^\+]+\+0000/), # Now in UTC. - 'datetime' => test_zci(qr/Unix Time: [^\+]+\+0000/), # Now in UTC. + #'epoch' => test_zci(qr/Unix Time: [^\+]+\+0000/), # Now in UTC. + #'timestamp' => test_zci(qr/Unix Time: [^\+]+\+0000/), # Now in UTC. + #'datetime' => test_zci(qr/Unix Time: [^\+]+\+0000/), # Now in UTC. ); done_testing;