Fast-forward master to working and delete working #1

Merged
AMNatty merged 29 commits from working into master 2022-04-06 09:04:32 +00:00
2 changed files with 7 additions and 8 deletions
Showing only changes of commit 2ec489ee65 - Show all commits

View File

@ -20,6 +20,7 @@
* Added support for version objects * Added support for version objects
* As a result, all fields except the version string are no longer compile-time constants * As a result, all fields except the version string are no longer compile-time constants
* `[PlutoCore]` Made `PlutoApplication`'s constructor private * `[PlutoCore]` Made `PlutoApplication`'s constructor private
* `[PlutoLib]` `MiniTimeParseException` no longer contains a hardcoded String message
Awaiting implementation: Awaiting implementation:
* `[PlutoLib]` Moved `cz.tefek.pluto.io.pluto.pp` to `cz.tefek.pluto.io.plutopackage` * `[PlutoLib]` Moved `cz.tefek.pluto.io.pluto.pp` to `cz.tefek.pluto.io.plutopackage`

View File

@ -47,12 +47,10 @@ public class MiniTime
{ {
public MiniTimeParseException() public MiniTimeParseException()
{ {
super("Time period could not be parsed. Correct format: \\_w\\_d\\_h\\_m\\_s **without spaces** between the units. You can skip a time unit. Example: 1h15m");
} }
} }
private static final TimeUnit miliseconds = TimeUnit.MILLISECONDS;
private static final int DAYS_IN_WEEK = 7; private static final int DAYS_IN_WEEK = 7;
private static final int HOURS_IN_DAY = 24; private static final int HOURS_IN_DAY = 24;
private static final int MINUTES_IN_HOUR = 60; private static final int MINUTES_IN_HOUR = 60;
@ -264,17 +262,17 @@ public class MiniTime
throw new IllegalArgumentException("Negative time span cannot be converted to MiniTime."); throw new IllegalArgumentException("Negative time span cannot be converted to MiniTime.");
} }
var xweeks = miliseconds.toDays(diff) / DAYS_IN_WEEK; var xweeks = TimeUnit.MILLISECONDS.toDays(diff) / DAYS_IN_WEEK;
if (xweeks > Integer.MAX_VALUE) if (xweeks > Integer.MAX_VALUE)
{ {
return "forever"; return "forever";
} }
var xdays = miliseconds.toDays(diff) % DAYS_IN_WEEK; var xdays = TimeUnit.MILLISECONDS.toDays(diff) % DAYS_IN_WEEK;
var xhours = miliseconds.toHours(diff) % HOURS_IN_DAY; var xhours = TimeUnit.MILLISECONDS.toHours(diff) % HOURS_IN_DAY;
var xminutes = miliseconds.toMinutes(diff) % MINUTES_IN_HOUR; var xminutes = TimeUnit.MILLISECONDS.toMinutes(diff) % MINUTES_IN_HOUR;
var xseconds = miliseconds.toSeconds(diff) % SECONDS_IN_MINUTE; var xseconds = TimeUnit.MILLISECONDS.toSeconds(diff) % SECONDS_IN_MINUTE;
return formatTime(xweeks, xdays, xhours, xminutes, xseconds); return formatTime(xweeks, xdays, xhours, xminutes, xseconds);
} }