Bug 5549 : Let Timestamp do the right thing if passed a DateTime
This commit is contained in:
parent
7c260e550e
commit
3b5ac7543a
1 changed files with 3 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue