OSDN Git Service

* epa.el (epa--format-seconds): New function.
authorDaiki Ueno <ueno@unixuser.org>
Mon, 29 May 2006 01:49:53 +0000 (01:49 +0000)
committerDaiki Ueno <ueno@unixuser.org>
Mon, 29 May 2006 01:49:53 +0000 (01:49 +0000)
(epa-show-key): Convert seconds from epoch to date.

ChangeLog
epa.el

index 6b4f505..2c0ef7e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-29  Daiki Ueno  <ueno@unixuser.org>
+
+       * epa.el (epa--format-seconds): New function.
+       (epa-show-key): Convert seconds from epoch to date.
+
 2006-05-28  Daiki Ueno  <ueno@unixuser.org>
 
        * epg.el (epg-start-import-keys): Don't specify filename if keys
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