From 0d0798e94f8d4931c9fd5b217f1408ef5a846a81 Mon Sep 17 00:00:00 2001 From: Miranda Marquez Date: Mon, 9 Sep 2024 17:57:52 -0800 Subject: [PATCH] simplify time display a bit expecting to change this stuff again later --- p11k.el | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/p11k.el b/p11k.el index 80e2506..07f942c 100644 --- a/p11k.el +++ b/p11k.el @@ -212,10 +212,15 @@ time the command took to complete in seconds. Outputteth a string." ;; TIMESTAMP is irrelevant for us - (let ((durstring (format "%.3fs" duration))) + (let ((durstring + (if (> duration p11k/duration-precision-cutoff) + (format "%.0fs" duration) + (format "%.3fs" duration)))) (p11k/spaced-concat (if (eq p11k/prompt-flow 'fluent) "took" "") (propertize durstring 'face 'p11k/yellow)))) +(defvar p11k/duration-precision-cutoff 3) +;; is there a better way to do above? perhaps with Format? (defun p11k/justificate (left-items right-items) "Concatenate LEFT-ITEMS and RIGHT-ITEMS with a gap between. @@ -280,8 +285,11 @@ Use 'window-width' to calculate the total final width." (p11k/spaced-concat (if (eq p11k/prompt-style 'fluent) "at" "") (propertize (pcase p11k/show-current-time - (12 (format-time-string "%I:%M:%S %p")) - (24 (format-time-string "%H:%M:%S")) + ;; not showing seconds rn + (12 (format-time-string "%I:%M %p")) + (24 (format-time-string "%H:%M")) + ;; (12 (format-time-string "%I:%M:%S %p")) + ;; (24 (format-time-string "%H:%M:%S")) (t "[bad time type]")) 'face 'p11k/cyan)) ""))