milkytracker / MilkyTracker

An FT2 compatible music tracker
http://milkytracker.github.io/
Other
1.7k stars 162 forks source link

incorrect leading zero formatting in sample editor timestamp #191

Closed Xunie closed 4 years ago

Xunie commented 4 years ago

Milkytracker version: 1.02.00 on both Windows and Linux

The sample editor's time indicator (in the bottom right) incorrectly formats 'human readable' time formats: 2.068 displays as 2.68 2.009 displays as 2.9

image

This happens because SampleEditorControl::formatMillis() in src/tracker/SampleEditorControl.cpp has multiple sprintf() calls with incorrect format string. It should not discard leading zeros: https://github.com/milkytracker/MilkyTracker/blob/119b9d7e35fcea8d891608f54e38d9d55412e4ea/src/tracker/SampleEditorControl.cpp#L276-L293

dwhinham commented 4 years ago

Thanks for the report and patch, I can't believe no-one's spotted this after all these years!

The same bad formatting occured in the top-right too, as you hover the mouse.

Fixed in 822cd0ac46f35ab866379b9d754403879ade5b80.