X509_CMP_TIME(3)

NAME
X509_cmp_time, X509_cmp_current_time, X509_time_adj_ex, X509_time_adj, X509_gmtime_adj - ASN.1 Time utilities

SYNOPSIS
#include <openssl/x509.h>
int
X509_cmp_time(const ASN1_TIME *asn1_time, time_t *cmp_time);
int
X509_cmp_current_time(const ASN1_TIME *asn1_time);
ASN1_TIME *
X509_time_adj_ex(ASN1_TIME *out_time, int offset_day, long offset_sec, time_t *in_time);
ASN1_TIME *
X509_time_adj(ASN1_TIME *out_time, long offset_sec, time_t *in_time);
ASN1_TIME *
X509_gmtime_adj(ASN1_TIME *out_time, long offset_sec);

DESCRIPTION
X509_cmp_time() parses asn1_time with ASN1_time_parse(3) and compares it to cmp_time, or to the current time if cmp_time is NULL. X509_cmp_current_time() compares it to the current time.

X509_time_adj_ex() sets out_time to a time offset_day and offset_sec later than in_time. The values of offset_day and offset_sec can be negative to set a time before in_time. The offset_sec value can also exceed the number of seconds in a day. If in_time is NULL, the current time is used instead. If out_time is NULL, a new ASN1_TIME structure is allocated and returned.

X509_time_adj() does the same with a 0 day offset.

X509_gmtime_adj() does the same using the current time instead of in_time, that is, it sets out_time to a time offset_sec seconds later than the current time.

RETURN VALUES
X509_cmp_time() and X509_cmp_current_time() return -1 if asn1_time is earlier than or equal to cmp_time, 1 if it is later, or 0 on error.

X509_time_adj_ex(), X509_time_adj(), and X509_gmtime_adj() return a pointer to the updated or newly allocated ASN1_TIME structure or NULL on error.

SEE ALSO
ASN1_TIME_new(3), ASN1_time_parse(3), ASN1_TIME_set(3), time(3)

HISTORY
X509_cmp_current_time() and X509_gmtime_adj() first appeared in SSLeay 0.6.0 and have been available since OpenBSD 2.4.

X509_cmp_time() and X509_time_adj() first appeared in OpenSSL 0.9.6 and have been available since OpenBSD 2.9.

X509_time_adj_ex() first appeared in OpenSSL 1.0.0 and has been available since OpenBSD 4.9.