Skip to content
This repository has been archived by the owner on Dec 22, 2021. It is now read-only.

Commit

Permalink
PERL-909 Fix BSON::Timestamp back-compat constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
xdg committed May 23, 2018
1 parent a3a158f commit 3bbeb9f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ Revision history for BSON

{{$NEXT}}

[Bugs]

- [PERL-641] Fix back-compatible BSON::Timestamp constructor
so that MongoDB::Timestamp can be an empty subclass of it.

v1.6.1 2018-05-17 13:41:11-04:00 America/New_York

[Bugs]
Expand Down
6 changes: 3 additions & 3 deletions lib/BSON/Timestamp.pm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use namespace::clean -except => 'meta';

my $max_int32 = 2147483647;

# Support back-compat 'secs' and inc' and legacy constructor shortcut
# Support back-compat 'sec' and inc' and legacy constructor shortcut
sub BUILDARGS {
my ($class) = shift;

Expand All @@ -46,8 +46,8 @@ sub BUILDARGS {
unless @_ % 2 == 0;

%args = @_;
$args{seconds} = $args{secs} if exists $args{secs} && !exists $args{seconds};
$args{increment} = $args{inc} if exists $args{inc} && !exists $args{increment};
$args{seconds} = $args{sec} if exists $args{sec} && !exists $args{seconds};
$args{increment} = $args{inc} if exists $args{inc} && !exists $args{increment};
}

$args{seconds} = time unless defined $args{seconds};
Expand Down

0 comments on commit 3bbeb9f

Please sign in to comment.