Note that the copy of strftime is equal to strptime , that is, if you need to analyze the time you can use strptime using the format string in the same way you use strftime to print the time using this format string:
>>> import time >>> t = time.strptime('12,12,12', '%H,%M,%S') >>> time.strftime('%H:%M:%S', t) '12:12:12'
So strptime does the check ( H<24, M<60, S<=61 ):
>>> time.strptime('24,0,0', '%H,%M,%S') ... ValueError: time data '24,0,0' does not match format '%H,%M,%S' >>> time.strptime('0,60,0', '%H,%M,%S') ... ValueError: time data '0,60,0' does not match format '%H,%M,%S' >>> time.strptime('0,0,62', '%H,%M,%S') ... ValueError: unconverted data remains: 2
Note that strptime allows S<=61 , as described in the documentation :
The range is valid from 0 to 61; this explains leap seconds and (very rare) double leap seconds.
If this is a problem for you, you probably need to parse this value in your code.