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