* epa.el (epa--format-seconds): New function.
[elisp/epg.git] / epa.el
diff --git a/epa.el b/epa.el
index 4269254..7596176 100644 (file)
--- a/epa.el
+++ b/epa.el
@@ -401,6 +401,12 @@ If SECRET is non-nil, list secret keys instead of public keys."
            (delete-window (get-buffer-window epa-keys-buffer)))
        (kill-buffer epa-keys-buffer))))
 
+(defun epa--format-seconds (seconds)
+  (let ((number-seconds (string-to-number (concat seconds ".0"))))
+    (format-time-string "%Y-%m-%d"
+                       (cons (floor (/ number-seconds 65536))
+                             (floor (mod number-seconds 65536))))))
+
 (defun epa-show-key (key)
   (let* ((primary-sub-key (car (epg-key-sub-key-list key)))
         (entry (assoc (epg-sub-key-id primary-sub-key)
@@ -450,10 +456,11 @@ If SECRET is non-nil, list secret keys instead of public keys."
              (cdr (assq (epg-sub-key-algorithm (car pointer))
                         epg-pubkey-algorithm-alist))
              "\n\tCreated: "
-             (epg-sub-key-creation-time (car pointer))
+             (epa--format-seconds (epg-sub-key-creation-time (car pointer)))
              (if (epg-sub-key-expiration-time (car pointer))
-                 (format "\n\tExpires: %s" (epg-sub-key-expiration-time
-                                            (car pointer)))
+                 (format "\n\tExpires: %s"
+                         (epa--format-seconds (epg-sub-key-expiration-time
+                                               (car pointer))))
                "")
              "\n\tCapabilities: "
              (mapconcat #'symbol-name