Skip to content
This repository has been archived by the owner on Jan 29, 2019. It is now read-only.

Commit

Permalink
Handle missing dates through parse failures directly
Browse files Browse the repository at this point in the history
  • Loading branch information
wavexx committed May 22, 2016
1 parent f6eac87 commit 384375c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fgallery
Original file line number Diff line number Diff line change
Expand Up @@ -596,14 +596,14 @@ foreach my $props(@aprops)
my $idate = $props->{'DateTimeOriginal'} || $props->{'DateTime'} || "";
$idate =~ s/^\s+|\s+$//g;

if(!$idate || $idate eq "0000:00:00 00:00:00")
my $t = eval { Time::Piece->strptime($idate, "%Y:%m:%d %H:%M:%S"); };
if(!$t || !$t->epoch)
{
# no date available, cheat by using the previous timestamp
$props->{stamp} = $ostamp = $ostamp + 1;
}
else
{
my $t = Time::Piece->strptime($idate, "%Y:%m:%d %H:%M:%S");
$props->{date} = $t->strftime("%Y-%m-%d %H:%M");
$props->{stamp} = $ostamp = $t->epoch;
}
Expand Down

0 comments on commit 384375c

Please sign in to comment.