UT1 top-level property

TimeInstantUnits UT1
final

Universal Time (UT1): UT1 = TDT - Delta T

Implementation

// ignore: non_constant_identifier_names
final TimeInstantUnits UT1 =
    TimeInstantUnits('Universal Time (UT1)', null, 'UT1', null, 1.0, false, 0.0, (dynamic val) {
  final d = val is num
      ? val.toDouble()
      : val is Number
          ? val.toDouble()
          : 0.0;
  return TDT.fromMks(d) - getDeltaT(TimeInstant(TAI: d));
}, (dynamic val) {
  final d = val is num
      ? val.toDouble()
      : val is Number
          ? val.toDouble()
          : 0.0;

  // Converge on a Delta T & TAI that work together
  var count = 0;
  var tai = d;
  const epsilon = 0.001;
  var deltaT = 0.0;
  var lastDeltaT = double.maxFinite;
  while (((deltaT - lastDeltaT).abs() > epsilon) && count < 100) {
    lastDeltaT = deltaT;
    tai = d - 32.184 + deltaT;
    deltaT = getDeltaT(TimeInstant(TAI: tai));
    count++;
  }

  // Return seconds in TAI time scale...
  return Double(tai);
});