Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add 0.5 ms in format track length functions to make sure they're roun…

…ding correctly.
  • Loading branch information...
commit 7fcda887e03201e7c72f20cf830584417de54eee 1 parent 808b5eb
@warpr warpr authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/MusicBrainz/Server/Track.pm
View
4 lib/MusicBrainz/Server/Track.pm
@@ -23,7 +23,7 @@ sub FormatTrackLength
return $ms unless looks_like_number($ms);
return "$ms ms" if $ms < 1000;
- my $seconds = $ms / 1000;
+ my $seconds = $ms / 1000.0 + 0.5;
my $pattern = $seconds >= 3600 ? "%H:%M:%S" : "%M:%S";
my $f = DateTime::Format::Duration->new (normalize => 1, pattern => $pattern);
@@ -35,7 +35,7 @@ sub FormatXSDTrackLength
my $ms = shift;
return undef unless $ms;
- my $length_in_secs = ($ms / 1000.0);
+ my $length_in_secs = ($ms / 1000.0 + 0.5);
sprintf "PT%dM%dS",
int($length_in_secs / 60),
($length_in_secs % 60),
Please sign in to comment.
Something went wrong with that request. Please try again.