Skip to content

Commit

Permalink
small optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Nov 13, 2013
1 parent f8b4ce6 commit 37b3b00
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/Mojo/Date.pm
Expand Up @@ -42,11 +42,8 @@ sub parse {
else { return $self }

# Prevent crash
my $epoch;
$epoch = eval { timegm($s, $m, $h, $day, $month, $year) };
$self->epoch($epoch) if !$@ && $epoch >= 0;

return $self;
my $epoch = eval { timegm($s, $m, $h, $day, $month, $year) };
return defined $epoch && $epoch >= 0 ? $self->epoch($epoch) : $self;
}

sub to_string {
Expand Down

0 comments on commit 37b3b00

Please sign in to comment.