Imported OpenSSL 1.1.1c
This commit is contained in:
@@ -173,38 +173,6 @@ certificates complying with RFC5280 et al use GMT anyway.
|
||||
Use the ASN1_TIME_normalize() function to normalize the time value before
|
||||
printing to get GMT results.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
Set a time structure to one hour after the current time and print it out:
|
||||
|
||||
#include <time.h>
|
||||
#include <openssl/asn1.h>
|
||||
|
||||
ASN1_TIME *tm;
|
||||
time_t t;
|
||||
BIO *b;
|
||||
|
||||
t = time(NULL);
|
||||
tm = ASN1_TIME_adj(NULL, t, 0, 60 * 60);
|
||||
b = BIO_new_fp(stdout, BIO_NOCLOSE);
|
||||
ASN1_TIME_print(b, tm);
|
||||
ASN1_STRING_free(tm);
|
||||
BIO_free(b);
|
||||
|
||||
Determine if one time is later or sooner than the current time:
|
||||
|
||||
int day, sec;
|
||||
|
||||
if (!ASN1_TIME_diff(&day, &sec, NULL, to))
|
||||
/* Invalid time format */
|
||||
|
||||
if (day > 0 || sec > 0)
|
||||
printf("Later\n");
|
||||
else if (day < 0 || sec < 0)
|
||||
printf("Sooner\n");
|
||||
else
|
||||
printf("Same\n");
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
ASN1_TIME_set(), ASN1_UTCTIME_set(), ASN1_GENERALIZEDTIME_set(), ASN1_TIME_adj(),
|
||||
@@ -238,6 +206,38 @@ ASN1_TIME_compare() returns -1 if B<a> is before B<b>, 0 if B<a> equals B<b>, or
|
||||
ASN1_TIME_to_generalizedtime() returns a pointer to
|
||||
the appropriate time structure on success or NULL if an error occurred.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
Set a time structure to one hour after the current time and print it out:
|
||||
|
||||
#include <time.h>
|
||||
#include <openssl/asn1.h>
|
||||
|
||||
ASN1_TIME *tm;
|
||||
time_t t;
|
||||
BIO *b;
|
||||
|
||||
t = time(NULL);
|
||||
tm = ASN1_TIME_adj(NULL, t, 0, 60 * 60);
|
||||
b = BIO_new_fp(stdout, BIO_NOCLOSE);
|
||||
ASN1_TIME_print(b, tm);
|
||||
ASN1_STRING_free(tm);
|
||||
BIO_free(b);
|
||||
|
||||
Determine if one time is later or sooner than the current time:
|
||||
|
||||
int day, sec;
|
||||
|
||||
if (!ASN1_TIME_diff(&day, &sec, NULL, to))
|
||||
/* Invalid time format */
|
||||
|
||||
if (day > 0 || sec > 0)
|
||||
printf("Later\n");
|
||||
else if (day < 0 || sec < 0)
|
||||
printf("Sooner\n");
|
||||
else
|
||||
printf("Same\n");
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The ASN1_TIME_to_tm() function was added in OpenSSL 1.1.1.
|
||||
@@ -248,7 +248,7 @@ The ASN1_TIME_compare() function was added in OpenSSL 1.1.1.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2015-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the OpenSSL license (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
Reference in New Issue
Block a user