From 590514ca12e3b22f4597ff670a65a7c8eafce4e6 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Thu, 1 Apr 2010 21:02:14 +0100 Subject: [PATCH] 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 --- C4/SIP/Sip.pm | 8 ++++++++ 1 file changed, 8 insertions(+) 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)); } -- 2.39.5