2
0

OPENSSL_gmtime.pod 2.0 KB

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