Fixed insane beat conversion results

This commit is contained in:
mirk0dex 2024-01-28 15:23:41 +01:00
parent 09485b016a
commit f7c40dd906
4 changed files with 16 additions and 5 deletions

View file

@ -10,8 +10,8 @@ android {
applicationId = "eu.mirkodi.swatchbeatclock"
minSdk = 24
targetSdk = 34
versionCode = 8
versionName = "v1.2"
versionCode = 9
versionName = "v1.2.1"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Binary file not shown.

View file

@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 8,
"versionName": "v1.2",
"versionCode": 9,
"versionName": "v1.2.1",
"outputFile": "app-release.apk"
}
],

View file

@ -72,7 +72,7 @@ public class InternetTime {
}
public static double timeToBeat(int hour, int minute, int seconds, int millis) {
return hoursToBeat(timeToDoubleHours(hour, minute, seconds, millis));
return sanitiseBeats(hoursToBeat(timeToDoubleHours(hour, minute, seconds, millis)));
}
public static double beatToDoubleHours(double beats) {
@ -100,4 +100,15 @@ public class InternetTime {
public double getInitial() {
return initial;
}
// > if beats is greater than 1000, 1000 is subtracted
// > if hour is less than 0, it's subtracted from 1000
public static double sanitiseBeats(double beats) {
if (beats > 1000) {
return beats - 1000;
} else if (beats < 0) {
return 1000 - beats;
}
return beats;
}
}