hrMinSec property

List<double> get hrMinSec

Gets the value of this angle in terms of hours, minutes and seconds (where there are 24 hours in a complete circle). The first value (hours) may be either positive or negative; the other two values will be positive.

Implementation

List<double> get hrMinSec {
  final hms = List<double>.generate(3, (_) => 0.0, growable: false);

  final decimalHours = valueInUnits(degrees).toDouble() / 15.0;

  // Hours
  hms[0] = decimalHours.toInt().toDouble();

  // Minutes
  final remainder1 = decimalHours.abs() - hms[0].abs();
  final decimalMinutes = remainder1 * 60.0;
  hms[1] = decimalMinutes.toInt().toDouble();

  // Seconds
  final remainder2 = decimalMinutes - hms[1];
  hms[2] = remainder2 * 60.0;

  return hms;
}