def timestamp_compare(time_a, time_b):
  """
  Compares two timestamps. Behaviour:
    if time_a < time_b:
      return -1
    elif time_a == time_b:
      return 0
    else:
      return 1
  """
  if time_a.seconds < time_b.seconds:
    return -1
  elif time_a.seconds > time_b.seconds:
    return 1
  else:
    if time_a.nanos < time_b.nanos:
      return -1
    elif time_a.nanos > time_b.nanos:
      return 1
    return 0