%02d gives at least 2 digits of padding with 0, i.e. 01 instead of 1, but your milliseconds number is over 3 digits, 230. You could use %03d instead to always pad up to three digits i.e. 001, or you could calculate centi-seconds instead, I suppose multiplying by 100 instead of 1,000 would do the trick.
Wait the poster did not specify why the formatting wasn’t working. I mean, 230 for milliseconds seems like the correct value since there are 1000 milliseconds in a second.
Two digit milliseconds don’t make sense, since there’s 1,000 milliseconds in a second. When you see something in the format XX:XX:XX it’s actually hours, minutes, and seconds.