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