SSL_SESSION_GET_TIME(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

πŸ’… SSL_SESSION_GET_TIME(3) β€” session time & timeout vibes

okay so this one lives in the Library Functions Manual section and bestie it is so useful. It's SSL_SESSION_get_time, SSL_SESSION_set_time, SSL_SESSION_get_timeout, SSL_SESSION_set_timeout, SSL_get_time, SSL_set_time, SSL_get_timeout, and SSL_set_timeout β€” and yes, that's a whole squad. Their collective job? retrieve and manipulate session time and timeout settings. πŸ•°οΈβœ¨


🌸 SYNOPSIS 🌸

library β€œlibssl” libcrypto #include <openssl/ssl.h>

long
SSL_SESSION_get_time(const SSL_SESSION *s);

long
SSL_SESSION_set_time(SSL_SESSION *s, long tm);

long
SSL_SESSION_get_timeout(const SSL_SESSION *s);

long
SSL_SESSION_set_timeout(SSL_SESSION *s, long tm);

long
SSL_get_time(const SSL_SESSION *s);

long
SSL_set_time(SSL_SESSION *s, long tm);

long
SSL_get_timeout(const SSL_SESSION *s);

long
SSL_set_timeout(SSL_SESSION *s, long tm);

πŸŽ€ DESCRIPTION πŸŽ€

So SSL_SESSION_get_time() returns the time at which the session s was established. It's given in seconds since the Epoch, which means it's compatible with whatever time(3) hands you β€” same units, same energy, no conversion drama. 🫢

SSL_SESSION_set_time() replaces the creation time of the session s with the chosen value tm. Your session, your rules, your timestamp. πŸ’…

SSL_SESSION_get_timeout() returns the timeout value set for session s, in seconds.

SSL_SESSION_set_timeout() sets the timeout value for session s in seconds to tm.

Now the glow-up: SSL_get_time(), SSL_set_time(), SSL_get_timeout(), and SSL_set_timeout() are synonyms for the SSL_SESSION_*() counterparts. Same functions, shorter names, we love an alias era. ✨

Sessions get expired by examining the creation time and the timeout value β€” both, together, the whole duo. Both are set at creation time of the session: the actual time, and the default timeout value at creation respectively, as set by SSL_CTX_set_timeout(3). And with these functions you can extend or shorten the lifetime of the session. Lengthen it, trim it, you're the main character here. πŸ‘‘


πŸ’– RETURN VALUES πŸ’–

  • SSL_SESSION_get_time() and SSL_SESSION_get_timeout() return the currently valid values.
  • SSL_SESSION_set_time() and SSL_SESSION_set_timeout() return 1 on success.
⚠️ If any of the functions is passed the NULL pointer for the session s, 0 is returned. no cap, protect your pointers bestie 😭

πŸ¦‹ SEE ALSO πŸ¦‹


⭐ HISTORY ⭐

SSL_get_time(), SSL_get_timeout(), and SSL_set_timeout() appeared in SSLeay 0.4 or earlier β€” literal ancients, iconic behavior. SSL_set_time() first appeared in SSLeay 0.5.2. Then SSL_SESSION_get_time(), SSL_SESSION_set_time(), SSL_SESSION_get_timeout(), and SSL_SESSION_set_timeout()` first appeared in **SSLeay 0.9.0. And all these functions have been available since OpenBSD 2.4. a whole legacy ✨🌈


okay that's the page!! this one came from the Debian build, dated June 8, 2025 β€” mwah, bye bestie, go set some timeouts πŸ“πŸŽ€

πŸ“¦ where this page comes from