From 8f6b0fc0931752acedee232f327b93ba45632062 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 23 Jan 2014 14:40:04 +0100 Subject: Result: Fix countdown_sec --- lib/Travel/Status/DE/URA/Result.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/Travel/Status') 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}; } -- cgit v1.2.3