1=pod
2
3=head1 NAME
4
5X509_cmp_time, X509_cmp_current_time, X509_time_adj, X509_time_adj_ex
6- X509 time functions
7
8=head1 SYNOPSIS
9
10 int X509_cmp_time(const ASN1_TIME *asn1_time, time_t *in_tm);
11 int X509_cmp_current_time(const ASN1_TIME *asn1_time);
12 ASN1_TIME *X509_time_adj(ASN1_TIME *asn1_time, long offset_sec, time_t *in_tm);
13 ASN1_TIME *X509_time_adj_ex(ASN1_TIME *asn1_time, int offset_day, long
14                             offset_sec, time_t *in_tm);
15
16=head1 DESCRIPTION
17
18X509_cmp_time() compares the ASN1_TIME in B<asn1_time> with the time
19in <cmp_time>. X509_cmp_current_time() compares the ASN1_TIME in
20B<asn1_time> with the current time, expressed as time_t. B<asn1_time>
21must satisfy the ASN1_TIME format mandated by RFC 5280, i.e., its
22format must be either YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ.
23
24X509_time_adj_ex() sets the ASN1_TIME structure B<asn1_time> to the time
25B<offset_day> and B<offset_sec> after B<in_tm>.
26
27X509_time_adj() sets the ASN1_TIME structure B<asn1_time> to the time
28B<offset_sec> after B<in_tm>. This method can only handle second
29offsets up to the capacity of long, so the newer X509_time_adj_ex()
30API should be preferred.
31
32In both methods, if B<asn1_time> is NULL, a new ASN1_TIME structure
33is allocated and returned.
34
35In all methods, if B<in_tm> is NULL, the current time, expressed as
36time_t, is used.
37
38=head1 BUGS
39
40Unlike many standard comparison functions, X509_cmp_time() and
41X509_cmp_current_time() return 0 on error.
42
43=head1 RETURN VALUES
44
45X509_cmp_time() and X509_cmp_current_time() return -1 if B<asn1_time>
46is earlier than, or equal to, B<cmp_time> (resp. current time), and 1
47otherwise. These methods return 0 on error.
48
49X509_time_adj() and X509_time_adj_ex() return a pointer to the updated
50ASN1_TIME structure, and NULL on error.
51
52=head1 COPYRIGHT
53
54Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
55
56Licensed under the OpenSSL license (the "License").  You may not use
57this file except in compliance with the License.  You can obtain a copy
58in the file LICENSE in the source distribution or at
59L<https://www.openssl.org/source/license.html>.
60
61=cut
62