getDurationFromAngles static method
Implementation
static String getDurationFromAngles(
double icon2AngleInRadians, double icon1AngleInRadians) {
double totalAngle = 0.0;
if (icon2AngleInRadians > icon1AngleInRadians) {
totalAngle = 2 * pi - icon2AngleInRadians + icon1AngleInRadians;
} else {
totalAngle = icon1AngleInRadians - icon2AngleInRadians;
}
double totalHours = (totalAngle / (2 * pi)) * 24;
int hourPart = totalHours.floor();
int minutes = ((totalHours - hourPart) * 60).ceil();
if (minutes == 60) {
hourPart += 1;
minutes = 0;
}
return "$hourPart hr $minutes min";
}