def sec2hms(sec):
    """
    Convert seconds to hours, minutes and seconds.
    """
    hours = int(sec/3600)
    minutes = int((sec -3600*hours)/60)
    seconds = int(sec -3600*hours -60*minutes)
    return hours,minutes,seconds