From 6889f263282217403ccba8064aec717f050c7efb Mon Sep 17 00:00:00 2001 From: Star Brilliant Date: Fri, 8 Nov 2013 19:54:09 +0800 Subject: [PATCH] Fix ConvertTimestamp(1.995)=='0:00:01.100' issue --- danmaku2ass.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/danmaku2ass.py b/danmaku2ass.py index 3c48641..2ea48c7 100755 --- a/danmaku2ass.py +++ b/danmaku2ass.py @@ -310,10 +310,11 @@ def CalculateLength(s): def ConvertTimestamp(timestamp): + timestamp = round(timestamp*100.0)/100.0 hour, minute = divmod(timestamp, 3600) minute, second = divmod(minute, 60) - centsecond = round((second-int(second))*100.0) - return '%d:%02d:%02d.%02d' % (int(hour), int(minute), int(second), centsecond) + centsecond = second-int(second) + return '%d:%02d:%02d.%02d' % (int(hour), int(minute), int(second), int(centsecond)) def ConvertType2(row, height, bottomReserved):