[Koha-patches] [PATCH] Bug 4364 - SIP Checkout dates incorrect
Colin Campbell
colin.campbell at ptfs-europe.com
Thu Apr 1 22:02:14 CEST 2010
Change timestamp routine to do the right thing when passed an iso date
Otherwise was generating an epoch date of 0
---
C4/SIP/Sip.pm | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/C4/SIP/Sip.pm b/C4/SIP/Sip.pm
index 558a1d4..44d877e 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));
}
--
1.6.6.1
More information about the Koha-patches
mailing list