from decimal import Decimal def format_temps_decimal(d): """ Formatte un Decimal représentant un nombre de secondes en HH:MM:SS.mmm — exemple : 00:06:52.820 """ d = Decimal(d) total_sec = float(d) hours = int(total_sec // 3600) minutes = int((total_sec % 3600) // 60) seconds = total_sec % 60 return f"{hours:02d}:{minutes:02d}:{seconds:06.3f}"