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:
parent
ce4a85f0db
commit
590514ca12
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue