From 0e404b28b4d4191228b8f351a1ba7d6c7b2d99a4 Mon Sep 17 00:00:00 2001 From: wangshilong Date: Thu, 2 Jan 2025 19:31:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E9=97=B4=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/isu/gaswellwatch/vo/command/Timing.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/isu/gaswellwatch/vo/command/Timing.java b/src/main/java/com/isu/gaswellwatch/vo/command/Timing.java index a071eb6..180cb26 100644 --- a/src/main/java/com/isu/gaswellwatch/vo/command/Timing.java +++ b/src/main/java/com/isu/gaswellwatch/vo/command/Timing.java @@ -74,8 +74,8 @@ public interface Timing { } String[] items = StringUtils.split(stringTime, ":"); int hours = Integer.parseInt(items[0]); - int minutes = items.length < 2 ? 0 : Integer.parseInt(items[1]); - int seconds = items.length < 3 ? 0 : Integer.parseInt(items[2]); + int minutes = items.length >= 2 ? 0 : Integer.parseInt(items[1]); + int seconds = items.length >= 3 ? 0 : Integer.parseInt(items[2]); return StringUtils.leftPad(Integer.toHexString(hours), 4, "0") + StringUtils.leftPad(Integer.toHexString(minutes), 4, "0") + StringUtils.leftPad(Integer.toHexString(seconds), 4, "0"); @@ -92,11 +92,11 @@ public interface Timing { int hours = 0, minutes = 0, seconds = 0; switch (values.length) { case 1 -> { - seconds = Integer.parseInt(values[0]); + hours = Integer.parseInt(values[0]); } case 2 -> { - minutes = Integer.parseInt(values[0]); - seconds = Integer.parseInt(values[1]); + hours = Integer.parseInt(values[0]); + minutes = Integer.parseInt(values[1]); } case 3 -> { hours = Integer.parseInt(values[0]);