Image-Synchronize
view release on metacpan or search on metacpan
lib/Image/Synchronize/CameraOffsets.pm view on Meta::CPAN
package Image::Synchronize::CameraOffsets;
=head1 NAME
Image::Synchronize::CameraOffsets - Manage time offsets for a range of
times
=head1 METHODS
The module provides the following methods:
=cut
use Modern::Perl;
use Carp;
use Clone;
use Image::Synchronize::Timestamp;
use Scalar::Util qw(
looks_like_number
);
use Time::Local qw(
timegm
);
use YAML::Any qw(
Load
Dump
);
use overload
'""' => \&stringify
;
=head2 new
$co = Image::Synchronize::CameraOffsets->new;
$co2 = $co->new;
Creates and returns a new instance of this class.
=cut
sub new {
my ( $invocant, %options ) = @_;
# all three hash references have structure
# $camera_id => { $time => $offset }
bless {
base => {},
added => {},
effective => {},
synchronized => 0,
exists( $options{log_callback} )
? ( log_callback => $options{log_callback} )
: (),
}, (ref($invocant) || $invocant);
}
=head2 set
$co = $co->set($camera_id, $time, $offset);
$co = $co->set($camera_id, $time, $offset, $file);
Declares a time offset for a particular time for a particular camera.
C<$camera_id> is the ID of the camera that took the image for which an
offset is specified.
C<$time> is the time (either in seconds since the epoch, as for
L<gmtime>, or else as an L<Image::Synchronize::Timestamp>) of the
image for which the offset is specified.
C<$offset> is the time offset that is valid at the specified C<$time>.
It must be either a number, or else an
( run in 2.181 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )