guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[shepherd] 09/10: herd: Use 'strftime' rather than 'date->string' for 's


From: Ludovic Courtès
Subject: [shepherd] 09/10: herd: Use 'strftime' rather than 'date->string' for 'status' output.
Date: Thu, 27 Apr 2023 10:16:36 -0400 (EDT)

civodul pushed a commit to branch master
in repository shepherd.

commit b05c51a6251b0982933d0598191f15fb733e135f
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Thu Apr 27 16:05:37 2023 +0200

    herd: Use 'strftime' rather than 'date->string' for 'status' output.
    
    * modules/shepherd/scripts/herd.scm (time->string)[absolute]: Use
    'strftime' instead of 'date->string'.
---
 modules/shepherd/scripts/herd.scm | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/modules/shepherd/scripts/herd.scm 
b/modules/shepherd/scripts/herd.scm
index 983c7b4..624b612 100644
--- a/modules/shepherd/scripts/herd.scm
+++ b/modules/shepherd/scripts/herd.scm
@@ -173,13 +173,15 @@ into a @code{live-service} record."
     (let* ((time    (make-time time-utc 0 time))
            (date    (time-utc->date time))
            (year    (date-year date))
-           (now     (time-utc->date now*))
-           (format  (if (= year (date-year now))
-                        (if (= (date-day date) (date-day now))
-                            "~H:~M:~S"
-                            "~e ~b ~H:~M:~S")
-                        "~e ~b ~Y ~H:~M:~S")))
-      (date->string date format)))
+           (now*    (time-utc->date now*))
+           ;; Note: Use 'strftime' rather than 'date->string' to better
+           ;; account for locale preferences.
+           (format  (if (= year (date-year now*))
+                        (if (= (date-day date) (date-day now*))
+                            "%X"
+                            "%c")
+                        "%c")))
+      (strftime format (localtime now))))
 
   ;; TRANSLATORS: The first placeholder is for a date string such as "April 22
   ;; 19:07:46" and the parenthesized placeholder is for the corresponding



reply via email to

[Prev in Thread] Current Thread [Next in Thread]