From 3b5ac7543ae482aa743d4e0c75424d31df0ccca0 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Tue, 21 Jun 2011 11:08:20 +0100 Subject: [PATCH] Bug 5549 : Let Timestamp do the right thing if passed a DateTime --- C4/SIP/Sip.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/C4/SIP/Sip.pm b/C4/SIP/Sip.pm index 337cc0e4d0..4e3f299afb 100644 --- a/C4/SIP/Sip.pm +++ b/C4/SIP/Sip.pm @@ -50,7 +50,9 @@ our $last_response = ''; sub timestamp { my $time = $_[0] || time(); - if ($time=~m/^(\d{4})\-(\d{2})\-(\d{2})/) { + if ( ref $time eq 'DateTime') { + return $time->strftime(SIP_DATETIME); + } elsif ($time=~m/^(\d{4})\-(\d{2})\-(\d{2})/) { # passing a db returned date as is + bogus time return sprintf( '%04d%02d%02d 235900', $1, $2, $3); } -- 2.39.5