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 <gmcharlt@gmail.com>
This commit is contained in:
Colin Campbell 2010-04-01 21:02:14 +01:00 committed by Galen Charlton
parent ce4a85f0db
commit 590514ca12
1 changed files with 8 additions and 0 deletions

View File

@ -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));
}