-.\" $OpenBSD: X509_cmp_time.3,v 1.3 2017/03/27 17:00:54 jmc Exp $
-.\" OpenSSL X509_cmp_time.pod 80770da3 Feb 17 19:00:15 2017 +0100
+.\" $OpenBSD: X509_cmp_time.3,v 1.4 2017/04/10 17:14:44 schwarze Exp $
+.\" OpenSSL X509_cmp_time.pod 24053693 Mar 28 14:27:37 2017 +0200
.\"
.\" This file was written by Emilia Kasper <emilia@openssl.org>
.\" Copyright (c) 2017 The OpenSSL Project. All rights reserved.
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: March 27 2017 $
+.Dd $Mdocdate: April 10 2017 $
.Dt X509_CMP_TIME 3
.Os
.Sh NAME
-.Nm X509_cmp_time
-.Nd compare an ASN.1 Time to a time in seconds since the Epoch
+.Nm X509_cmp_time ,
+.Nm X509_cmp_current_time ,
+.Nm X509_time_adj_ex ,
+.Nm X509_time_adj
+.Nd ASN.1 Time utilities
.Sh SYNOPSIS
.In openssl/x509.h
.Ft int
.Fa "const ASN1_TIME *asn1_time"
.Fa "time_t *cmp_time"
.Fc
+.Ft int
+.Fo X509_cmp_current_time
+.Fa "const ASN1_TIME *asn1_time"
+.Fc
+.Ft ASN1_TIME *
+.Fo X509_time_adj_ex
+.Fa "ASN1_TIME *asn1_time"
+.Fa "int offset_day"
+.Fa "long offset_sec"
+.Fa "time_t *in_tm"
+.Fc
+.Ft ASN1_TIME *
+.Fo X509_time_adj
+.Fa "ASN1_TIME *asn1_time"
+.Fa "long offset_sec"
+.Fa "time_t *in_tm"
+.Fc
.Sh DESCRIPTION
.Fn X509_cmp_time
parses
.Xr ASN1_time_parse 3
and compares it to
.Fa cmp_time .
+.Fn X509_cmp_current_time
+compares it to the current time.
+.Pp
+.Fn X509_time_adj_ex
+sets
+.Fa asn1_time
+to a time
+.Fa offset_day
+and
+.Fa offset_sec
+later than
+.Fa in_tm .
+.Fn X509_time_adj
+does the same with a 0 day offset.
If
-.Fa cmp_time
+.Fa asn1_time
+is
+.Dv NULL ,
+a new
+.Vt ASN1_TIME
+structure is allocated and returned.
+.Pp
+In all functions, if
+.Fa in_tm
is
.Dv NULL ,
the current time is used.
.Sh RETURN VALUES
.Fn X509_cmp_time
-returns -1 if
+and
+.Fn X509_cmp_current_time
+return -1 if
.Fa asn1_time
is earlier than or equal to
.Fa cmp_time ,
1 if it is later, or 0 on error.
+.Pp
+.Fn X509_time_adj_ex
+and
+.Fn X509_time_adj
+return a pointer to the updated
+.Vt ASN1_TIME
+structure or
+.Dv NULL
+on error.
.Sh SEE ALSO
.Xr ASN1_time_parse 3 ,
.Xr time 3