From dc8b86f65f6b24a97508462f8a5d0d7c94128086 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Fri, 21 Apr 2017 12:56:23 +1200 Subject: [PATCH] Bug 18299 - Implemented new locatime function to compare against the value of the output of the get_current_time() function --- t/db_dependent/Context.t | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/t/db_dependent/Context.t b/t/db_dependent/Context.t index d36c106..dfc1646 100755 --- a/t/db_dependent/Context.t +++ b/t/db_dependent/Context.t @@ -150,10 +150,9 @@ sub get_current_time { $sth->execute(); return $sth->fetchrow_array;# Return a time value rather than hash value } -my $datetime = DateTime->now; -my $date = $datetime->ymd; -my $time = $datetime->hms; -my $compardt = "$date $time"; + +my ($second,$min,$hour,$mday,$month,$year,$weekday,$yday,$isdst) = localtime(time); +my $compardt = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $year+1900, $month+1, $mday, $hour, $min, $second); my $current_time = get_current_time(); is($current_time, $compardt, "Correct time"); -- 2.1.4