def _formatTimeDelta(t):
  """Return a string representation of the time to millisecond precision."""
  
  hours = t.seconds // 3600
  minutes = (t.seconds / 60) % 60
  seconds = t.seconds % 60
  milliseconds = t.microseconds // 1000

  if t.days:
    return "%i days, %i:%02i:%02i.%03i" % (
      t.days, hours, minutes, seconds, milliseconds)
  else:
    return "%i:%02i:%02i.%03i" % (hours, minutes, seconds, milliseconds)