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