OPENSSL_GMTIME(3ossl)
β¨ NAME β¨
Okay bestie, welcome to OPENSSL_GMTIME(3ossl) π β these are OPENSSL_gmtime, OPENSSL_gmtime_adj, and OPENSSL_gmtime_diff, the platform-agnostic OpenSSL time routines. Itβs giving βtime stuff, but portableβ and honestly? slay.
π¦ 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 puts it into the result argument you handed over. Very βhereβs your time, bestieβ β¨
OPENSSL_gmtime_adj() adds the offsets in offset_day and offset_sec to tm. Itβs adjusting the vibe by days and seconds, periodt π
OPENSSL_gmtime_diff() calculates the difference between from and to. Itβs literally doing time math between two struct tms π
π NOTES π
Calling OPENSSL_gmtime() with result equal to NULL is an error β do not do that, bestie π The contents of the time_t given by timer are stored into the result. And if you call it with timer equal to NULL, that means use the current time π°οΈ
OPENSSL_gmtime_adj() converts tm into a days and seconds value, adds the offsets, then converts back into the struct tm specified by tm. Leap seconds are not considered β not even a little bit π
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 here either π
πΈ 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. iconic behavior, no cap π
π 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>.
okay bye bestie π«Ά β this page is from OpenSSL 3.5.0, dated 2026-09-25, and the manual tag is OPENSSL_GMTIME(3ossl) β¨π
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms