From: Colin Campbell Date: Thu, 1 Apr 2010 20:02:14 +0000 (+0100) Subject: Bug 4364 - SIP Checkout dates incorrect X-Git-Tag: v3.02.00-alpha2~209 X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=590514ca12e3b22f4597ff670a65a7c8eafce4e6;p=koha.git Bug 4364 - SIP Checkout dates incorrect Change timestamp routine to do the right thing when passed an iso date Otherwise was generating an epoch date of 0 Signed-off-by: Galen Charlton --- diff --git a/C4/SIP/Sip.pm b/C4/SIP/Sip.pm index f176516b99..c76959b657 100644 --- a/C4/SIP/Sip.pm +++ b/C4/SIP/Sip.pm @@ -9,6 +9,7 @@ use warnings; use English; use Exporter; +use DateTime; use Sys::Syslog qw(syslog); use POSIX qw(strftime); use Socket qw(:crlf); @@ -49,6 +50,13 @@ our $last_response = ''; sub timestamp { my $time = $_[0] || time(); + if ($time=~m/^(\d{4})\-(\d{2})\-(\d{2})/) { + my $dt = DateTime->new( + year => $1, + month => $2, + day => $3); + $time = $dt->epoch(); + } return strftime(SIP_DATETIME, localtime($time)); }