diff options
author | Daniel Friesel <derf@finalrewind.org> | 2014-01-23 14:40:04 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2014-01-23 14:40:04 +0100 |
commit | 8f6b0fc0931752acedee232f327b93ba45632062 (patch) | |
tree | 8305032bc05545b41517d49b364e319ac6eb61ea /lib/Travel/Status/DE/URA | |
parent | 9370341ffbfa7cb1eae628ee4ea69acd38dd0e73 (diff) |
Result: Fix countdown_sec
Diffstat (limited to 'lib/Travel/Status/DE/URA')
-rw-r--r-- | lib/Travel/Status/DE/URA/Result.pm | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Travel/Status/DE/URA/Result.pm b/lib/Travel/Status/DE/URA/Result.pm index e8cb1e8..3266d62 100644 --- a/lib/Travel/Status/DE/URA/Result.pm +++ b/lib/Travel/Status/DE/URA/Result.pm @@ -6,6 +6,8 @@ use 5.010; use parent 'Class::Accessor'; +use DateTime::Format::Duration; + our $VERSION = '0.02'; Travel::Status::DE::URA::Result->mk_ro_accessors( @@ -30,10 +32,10 @@ sub countdown { sub countdown_sec { my ($self) = @_; + my $secpattern = DateTime::Format::Duration->new( pattern => '%s' ); - $self->{countdown_sec} - //= $self->datetime->subtract_datetime( $self->{dt_now} ) - ->in_units('seconds'); + $self->{countdown_sec} //= $secpattern->format_duration( + $self->datetime->subtract_datetime( $self->{dt_now} ) ); return $self->{countdown_sec}; } |