mpatric / mp3agic

A java library for reading mp3 files and reading / manipulating the ID3 tags (ID3v1 and ID3v2.2 through ID3v2.4).
MIT License
1.2k stars 310 forks source link

Trouble in Different Answers On Converting From Seconds To Minutes #142

Closed tusharshivan closed 7 years ago

tusharshivan commented 7 years ago

Hello There, I was having a problem to get my understanding right for using Mp3Agic to get duration of MP3 file.

I used " mp3file.getLengthInSeconds " to get duration of a MP3 file but when I use calculator to convert them to minute, it doesn't show same duration of the MP3 file. But if I write a program to convert seconds to minutes, the calculation is same to the original duration. Why is THAT DIFFERENCE?

Thank You Tushar secondstominutes secondstominutes1

mpatric commented 7 years ago

206 seconds is 3 minutes and 26 seconds (3.43333 minutes)

What are you expecting to see?

tusharshivan commented 7 years ago

Well if we do math, we divide seconds with 60. So if we divide 206 seconds with 60, we get 3:43 minute. But if I use / and %, I get true length of the file. Why is that?

mpatric commented 7 years ago

There are 60 seconds in a minute, not 100

tusharshivan commented 7 years ago

Thanks