From 6bbc5e1824277d72ba2a50da3eb9361de5ffde42 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Tue, 24 Jul 2018 00:05:07 +1000 Subject: [PATCH] + Subtitle::TimePoint --- lib/Subtitle/TimePoint.pm | 37 +++++++++++++++++++++++++++++++++++++ t/timepoint.t | 28 ++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 lib/Subtitle/TimePoint.pm create mode 100644 t/timepoint.t diff --git a/lib/Subtitle/TimePoint.pm b/lib/Subtitle/TimePoint.pm new file mode 100644 index 0000000..45a57da --- /dev/null +++ b/lib/Subtitle/TimePoint.pm @@ -0,0 +1,37 @@ +package Subtitle::TimePoint; + +use strict; +use warnings; + +use Subtitle::Utils ':timing'; + +sub new { + my ($class, %args) = @_; + my $self = { + shift => $args{shift} || 0.0, + time => $args{time} || 0.0, + }; + return bless($self, $class); +} + +sub parse { + my ($self, $timespec) = @_; + + return 'empty timespec, nothing to do' + unless $timespec; + return 'wrong timespec, expected