xref: /freebsd/crypto/openssl/doc/man3/OPENSSL_gmtime.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1*b077aed3SPierre Pronchery=pod
2*b077aed3SPierre Pronchery
3*b077aed3SPierre Pronchery=head1 NAME
4*b077aed3SPierre Pronchery
5*b077aed3SPierre ProncheryOPENSSL_gmtime,
6*b077aed3SPierre ProncheryOPENSSL_gmtime_adj,
7*b077aed3SPierre ProncheryOPENSSL_gmtime_diff - platform-agnostic OpenSSL time routines
8*b077aed3SPierre Pronchery
9*b077aed3SPierre Pronchery=head1 SYNOPSIS
10*b077aed3SPierre Pronchery
11*b077aed3SPierre Pronchery #include <openssl/crypto.h>
12*b077aed3SPierre Pronchery
13*b077aed3SPierre Pronchery struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result);
14*b077aed3SPierre Pronchery int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec);
15*b077aed3SPierre Pronchery int OPENSSL_gmtime_diff(int *pday, int *psec,
16*b077aed3SPierre Pronchery                        const struct tm *from, const struct tm *to);
17*b077aed3SPierre Pronchery
18*b077aed3SPierre Pronchery=head1 DESCRIPTION
19*b077aed3SPierre Pronchery
20*b077aed3SPierre ProncheryOPENSSL_gmtime() returns the UTC time specified by I<timer> into the provided
21*b077aed3SPierre ProncheryI<result> argument.
22*b077aed3SPierre Pronchery
23*b077aed3SPierre ProncheryOPENSSL_gmtime_adj() adds the offsets in I<offset_day> and I<offset_sec> to I<tm>.
24*b077aed3SPierre Pronchery
25*b077aed3SPierre ProncheryOPENSSL_gmtime_diff() calculates the difference between I<from> and I<to>.
26*b077aed3SPierre Pronchery
27*b077aed3SPierre Pronchery=head1 NOTES
28*b077aed3SPierre Pronchery
29*b077aed3SPierre ProncheryIt is an error to call OPENSSL_gmtime() with I<result> equal to NULL. The
30*b077aed3SPierre Proncherycontents of the time_t given by I<timer> are stored into the I<result>. Calling
31*b077aed3SPierre Proncherywith I<timer> equal to NULL means use the current time.
32*b077aed3SPierre Pronchery
33*b077aed3SPierre ProncheryOPENSSL_gmtime_adj() converts I<tm> into a days and seconds value, adds the
34*b077aed3SPierre Proncheryoffsets, then converts back into a I<struct tm> specified by I<tm>. Leap seconds
35*b077aed3SPierre Proncheryare not considered.
36*b077aed3SPierre Pronchery
37*b077aed3SPierre ProncheryOPENSSL_gmtime_diff() calculates the difference between the two I<struct tm>
38*b077aed3SPierre Proncherystructures I<from> and I<to>. The difference in days is placed into I<*pday>,
39*b077aed3SPierre Proncherythe remaining seconds are placed to I<*psec>. The value in I<*psec> will be less
40*b077aed3SPierre Proncherythan the number of seconds per day (3600). Leap seconds are not considered.
41*b077aed3SPierre Pronchery
42*b077aed3SPierre Pronchery=head1 RETURN VALUES
43*b077aed3SPierre Pronchery
44*b077aed3SPierre ProncheryOPENSSL_gmtime() returns NULL on error, or I<result> on success.
45*b077aed3SPierre Pronchery
46*b077aed3SPierre ProncheryOPENSSL_gmtime_adj() and OPENSSL_gmtime_diff() return 0 on error, and 1 on success.
47*b077aed3SPierre Pronchery
48*b077aed3SPierre Pronchery=head1 HISTORY
49*b077aed3SPierre Pronchery
50*b077aed3SPierre ProncheryOPENSSL_gmtime(), OPENSSL_gmtime_adj() and OPENSSL_gmtime_diff() have been
51*b077aed3SPierre Proncheryin OpenSSL since 1.0.0.
52*b077aed3SPierre Pronchery
53*b077aed3SPierre Pronchery=head1 COPYRIGHT
54*b077aed3SPierre Pronchery
55*b077aed3SPierre ProncheryCopyright 2022 The OpenSSL Project Authors. All Rights Reserved.
56*b077aed3SPierre Pronchery
57*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
58*b077aed3SPierre Proncherythis file except in compliance with the License.  You can obtain a copy
59*b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at
60*b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>.
61*b077aed3SPierre Pronchery
62*b077aed3SPierre Pronchery=cut
63