OPENSSL_GMTIME(3ossl)
β¨ OPENSSL_GMTIME β¨
okay bestie so this is the OPENSSL_gmtime(3ossl) page, aka the platform-agnostic OpenSSL time routines π and yes it lives in the OpenSSL manual, we been knew.
π¦ NAME π¦
OPENSSL_gmtime, OPENSSL_gmtime_adj, OPENSSL_gmtime_diff β the platform-agnostic OpenSSL time routines, periodt. β°β¨
πΈ SYNOPSIS πΈ
like, here's the whole vibe, copy it exactly okay:
#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 π
so here's what each one does, no gatekeeping:
OPENSSL_gmtime()β hands you the UTC time that timer is pointing at, and drops it right into theresultargument you gave it. cute, efficient, slay. π«ΆOPENSSL_gmtime_adj()β takes the offsets inoffset_dayandoffset_secand, like, adds them totm. simple math bestie. βOPENSSL_gmtime_diff()β does the whole calculate the difference betweenfromandtothing. iconic behaviour honestly. π₯
π NOTES π
listen up because this part is important:
callingOPENSSL_gmtime()withresultequal toNULLis an error. not a vibe. don't do it. π
the contents of the time_t given by timer get stored into the result. and if you call it with timer equal to NULL, that means use the current time. (yes, "now o'clock", we love her.) β³
OPENSSL_gmtime_adj() converts tm into a days-and-seconds value, adds the offsets, then converts it back into a struct tm specified by tm. leap seconds are not considered. nope, not even a little. π
OPENSSL_gmtime_diff() calculates the difference between the two struct tm structures from and to. the difference in days gets placed into *pday, and the remaining seconds go into *psec. the value in *psec will be less than the number of seconds per day (3600). leap seconds? not considered. again. π°οΈ
π RETURN VALUES π
OPENSSL_gmtime()returnsNULLon error, orresulton success. β¨OPENSSL_gmtime_adj()andOPENSSL_gmtime_diff()return0on error, and1on success. π
π HISTORY π
OPENSSL_gmtime(), OPENSSL_gmtime_adj() and OPENSSL_gmtime_diff() have been in OpenSSL since 1.0.0. they're basically elders, and we respect them. π
π COPYRIGHT π
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>.
and that's the whole page bestie, no cap π this was OPENSSL_GMTIME(3ossl) from OpenSSL version 3.5.9, dated 2026-09-29 β catch you in the group chat, mwah π«ΆπΈ
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms