OPENSSL_GMTIME(3ossl)

πŸ“¦
version 15.1 Β· 3 versions
, in freebsd 15.1

πŸ•°οΈ OPENSSL_GMTIME(3ossl) πŸ•°οΈ

okay so this is the OpenSSL manual page for the platform-agnostic time besties: OPENSSL_gmtime, OPENSSL_gmtime_adj, and OPENSSL_gmtime_diff. They handle time stuff without making you fight the platform, and honestly? iconic. πŸ’…


✨ NAME ✨

OPENSSL_gmtime, OPENSSL_gmtime_adj, OPENSSL_gmtime_diff β€” platform-agnostic OpenSSL time routines 🫢


πŸ› οΈ SYNOPSIS πŸ› οΈ

#include <openssl/crypto.h>

struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result);
int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec);
int OPENSSL_gmtime_diff(int *pday, int *psec,
                       const struct tm *from, const struct tm *to);

🌸 DESCRIPTION 🌸

  • OPENSSL_gmtime() β€” takes the UTC time specified by timer and returns it into the provided result argument. UTC slay. 🌍
  • OPENSSL_gmtime_adj() β€” adds the offsets in offset_day and offset_sec to tm. little time adjustment moment ✨
  • OPENSSL_gmtime_diff() β€” calculates the difference between from and to. time math, but make it official πŸ’–

🧚 NOTES 🧚

It is an error to call OPENSSL_gmtime() with result equal to NULL. Like, do not do that, bestie. 🫠 The contents of the time_t given by timer are stored into the result. Calling with timer equal to NULL means use the current time. πŸ•°οΈ

OPENSSL_gmtime_adj() converts tm into a days and seconds value, adds the offsets, then converts back into a struct tm specified by tm. Leap seconds are not considered. ⏳ no leap-second drama here.

OPENSSL_gmtime_diff() calculates the difference between the two struct tm structures from and to. The difference in days is placed into *pday, and the remaining seconds are placed into *psec. The value in *psec will be less than the number of seconds per day (3600). Leap seconds are not considered. πŸŒ€


πŸŽ€ RETURN VALUES πŸŽ€

  • OPENSSL_gmtime() β€” returns NULL on error, or result on success. βœ…
  • OPENSSL_gmtime_adj() and OPENSSL_gmtime_diff() β€” return 0 on error, and 1 on success. 🫢

πŸ‘‘ HISTORY πŸ‘‘

OPENSSL_gmtime(), OPENSSL_gmtime_adj(), and OPENSSL_gmtime_diff() have been in OpenSSL since 1.0.0. vintage but still main character energy. πŸ’œ


Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.


xoxo, this page is from OpenSSL 3.5.6, dated 2026-04-07 β€” bye bestie, go have a very UTC day πŸŒˆπŸ’…

πŸ“¦ where this page comes from