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