From 210716ba3cb39565bd12cfccd59029750176a2b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Kubitz?= Date: Tue, 17 Sep 2024 14:59:02 +0200 Subject: [PATCH] ProcessConsole: skip milliseconds while running. it's updating only once a second anyway --- .../debug/internal/ui/views/console/ProcessConsole.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java index b28be3bdd0d..33df4701a2c 100644 --- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java +++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java @@ -337,12 +337,16 @@ protected String computeName() { DateFormat dateTimeFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); Duration elapsedTime = Duration.between(launchTime != null ? launchTime.toInstant() : Instant.now(), terminateTime != null ? terminateTime.toInstant() : Instant.now()); - String elapsedString = String.format("%d:%02d:%02d.%03d", elapsedTime.toHours(), //$NON-NLS-1$ - elapsedTime.toMinutesPart(), elapsedTime.toSecondsPart(), elapsedTime.toMillisPart()); + String elapsedFormat = "%d:%02d:%02d.%03d"; //$NON-NLS-1$ if (terminateTime == null) { + // refresh every second: DebugUIPlugin.getStandardDisplay().asyncExec( () -> DebugUIPlugin.getStandardDisplay().timerExec(1000, () -> resetName(false))); + // pointless to update milliseconds: + elapsedFormat = "%d:%02d:%02d"; //$NON-NLS-1$ } + String elapsedString = String.format(elapsedFormat, elapsedTime.toHours(), + elapsedTime.toMinutesPart(), elapsedTime.toSecondsPart(), elapsedTime.toMillisPart()); if (launchTime != null && terminateTime != null) { String launchTimeStr = dateTimeFormat.format(launchTime); // Check if process started and terminated at same day. If so only print the