时间问题修复
This commit is contained in:
parent
fe0e17baa3
commit
0e404b28b4
|
@ -74,8 +74,8 @@ public interface Timing {
|
||||||
}
|
}
|
||||||
String[] items = StringUtils.split(stringTime, ":");
|
String[] items = StringUtils.split(stringTime, ":");
|
||||||
int hours = Integer.parseInt(items[0]);
|
int hours = Integer.parseInt(items[0]);
|
||||||
int minutes = items.length < 2 ? 0 : Integer.parseInt(items[1]);
|
int minutes = items.length >= 2 ? 0 : Integer.parseInt(items[1]);
|
||||||
int seconds = items.length < 3 ? 0 : Integer.parseInt(items[2]);
|
int seconds = items.length >= 3 ? 0 : Integer.parseInt(items[2]);
|
||||||
return StringUtils.leftPad(Integer.toHexString(hours), 4, "0") +
|
return StringUtils.leftPad(Integer.toHexString(hours), 4, "0") +
|
||||||
StringUtils.leftPad(Integer.toHexString(minutes), 4, "0") +
|
StringUtils.leftPad(Integer.toHexString(minutes), 4, "0") +
|
||||||
StringUtils.leftPad(Integer.toHexString(seconds), 4, "0");
|
StringUtils.leftPad(Integer.toHexString(seconds), 4, "0");
|
||||||
|
@ -92,11 +92,11 @@ public interface Timing {
|
||||||
int hours = 0, minutes = 0, seconds = 0;
|
int hours = 0, minutes = 0, seconds = 0;
|
||||||
switch (values.length) {
|
switch (values.length) {
|
||||||
case 1 -> {
|
case 1 -> {
|
||||||
seconds = Integer.parseInt(values[0]);
|
hours = Integer.parseInt(values[0]);
|
||||||
}
|
}
|
||||||
case 2 -> {
|
case 2 -> {
|
||||||
minutes = Integer.parseInt(values[0]);
|
hours = Integer.parseInt(values[0]);
|
||||||
seconds = Integer.parseInt(values[1]);
|
minutes = Integer.parseInt(values[1]);
|
||||||
}
|
}
|
||||||
case 3 -> {
|
case 3 -> {
|
||||||
hours = Integer.parseInt(values[0]);
|
hours = Integer.parseInt(values[0]);
|
||||||
|
|
Loading…
Reference in New Issue