openssl coding得到过期时间

#include <stdio.h>
#include <string.h>

#include <openssl/rand.h>
#include <openssl/asn1t.h>
#include <openssl/pem.h>
#include <openssl/bio.h>

#include "lws-pub.h"
#include "lws-sha1-base64.h"


static char* ECDSACertPEM = "-----BEGIN CERTIFICATE-----\n"
"MIIGxzCCBa+gAwIBAgIIc54uwAnLX20wDQYJKoZIhvcNAQELBQAwgbQxCzAJBgNV\n"
"...\n"
"...\n"
"MXYXS/YRsQ1FZrOK0RL3Ts624N4QZnfIxLspqiRo6wlCvUutLRe1QieqVfjm7SYp\n"
"r7rWE+e3ef9C+es=\n"
"-----END CERTIFICATE-----\n";

int main()
{
    uint8_t * p = NULL;
    lws_filepos_t flen = 0;

    BIO* bio_buf = BIO_new(BIO_s_mem());
    BIO_write(bio_buf, ECDSACertPEM, strlen(ECDSACertPEM));
    X509 * cert = PEM_read_bio_X509(bio_buf, NULL, NULL, NULL);
    const ASN1_TIME *tm = X509_get0_notAfter(cert);
    printf("date: %s \r\n", tm->data);

    BIO_free(bio_buf);
    X509_free(cert);

    struct tm tm1;
    ASN1_TIME_to_tm(tm, &tm1);
    
    printf("date: %d-%d-%d \r\n", 1900+tm1.tm_year, 1+tm1.tm_mon, tm1.tm_mday);

    getchar();
    return 0;
}