emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] nsm 02/04: Return the valid-from/to as a string instead of


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] nsm 02/04: Return the valid-from/to as a string instead of an integer
Date: Tue, 18 Nov 2014 14:33:21 +0000

branch: nsm
commit 9484ae8fc48e3098581c9a1dc4675ab7bc5bc6e1
Author: Lars Magne Ingebrigtsen <address@hidden>
Date:   Tue Nov 18 15:11:53 2014 +0100

    Return the valid-from/to as a string instead of an integer
    
    The integer might not fit in all Emacs ints
---
 src/gnutls.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/gnutls.c b/src/gnutls.c
index 3e8eaab..39854a0 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -769,11 +769,19 @@ gnutls_certificate_details (gnutls_x509_crt_t cert)
 
   /* Validity. */
   {
+    char buf[11];
+    size_t buf_size = sizeof (buf);
+    struct tm t;
     time_t tim = gnutls_x509_crt_get_activation_time (cert);
-    res = nconc2 (res, list2 (intern (":valid-from"), make_number (tim)));
+
+    if (gmtime_r (&tim, &t) != NULL &&
+       strftime (buf, buf_size, "%Y-%m-%d", &t) != 0)
+      res = nconc2 (res, list2 (intern (":valid-from"), build_string (buf)));
 
     tim = gnutls_x509_crt_get_expiration_time (cert);
-    res = nconc2 (res, list2 (intern (":valid-to"), make_number (tim)));
+    if (gmtime_r (&tim, &t) != NULL &&
+       strftime (buf, buf_size, "%Y-%m-%d", &t) != 0)
+      res = nconc2 (res, list2 (intern (":valid-to"), build_string (buf)));
   }
 
   /* Subject. */



reply via email to

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