def parse_short_time_label(label):
 (days, hours, minutes, seconds) = ('0', '0', '0', '0')
 if ('-' in label):
  (days, label) = label.split('-', 1)
 time_comp = label.split(':')
 if (len(time_comp) == 3):
  (hours, minutes, seconds) = time_comp
 elif (len(time_comp) == 2):
  (minutes, seconds) = time_comp
 else:
  raise ValueError(("Invalid time format, we expected '[[dd-]hh:]mm:ss' or 'mm:ss.ss': %s" % label))
 try:
  time_sum = int(float(seconds))
  time_sum += (int(minutes) * 60)
  time_sum += (int(hours) * 3600)
  time_sum += (int(days) * 86400)
  return time_sum
 except ValueError:
  raise ValueError(('Non-numeric value in time entry: %s' % label))

def parse_short_time_label ( label ) : ( days , hours , minutes , seconds ) = ( '0' , '0' , '0' , '0' ) if ( '-' in label ) : ( days , label ) = label . split ( '-' , 1 ) time_comp = label . split ( ':' ) if ( len ( time_comp ) == 3 ) : ( hours , minutes , seconds ) = time_comp elif ( len ( time_comp ) == 2 ) : ( minutes , seconds ) = time_comp else : raise ValueError ( ( "Invalid time format, we expected '[[dd-]hh:]mm:ss' or 'mm:ss.ss': %s" % label ) ) try : time_sum = int ( float ( seconds ) ) time_sum += ( int ( minutes ) * 60 ) time_sum += ( int ( hours ) * 3600 ) time_sum += ( int ( days ) * 86400 ) return time_sum except ValueError : raise ValueError ( ( 'Non-numeric value in time entry: %s' % label ) )
provides the number of seconds corresponding to the formatting used for the cputime and etime fields of ps: [[dd-]hh:]mm:ss or mm:ss .