---
name: "libressl-SSL_SESSION_get_time"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-SSL_SESSION_get_time"
---

# libressl-SSL\_SESSION\_get\_time(3)

retrieve and manipulate session time and timeout settings

## NAME

**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**, **SSL\_set\_timeout** – retrieve and manipulate session time and timeout settings

## SYNOPSIS

SSL Library (libssl, -lssl) 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

**SSL\_SESSION\_get\_time**() returns the time at which the session *s* was established. The time is given in seconds since the Epoch and therefore compatible to the time delivered by the [time(3)](/time/3.md) call.

**SSL\_SESSION\_set\_time**() replaces the creation time of the session *s* with the chosen value *tm*.

**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*.

The **SSL\_get\_time**(), **SSL\_set\_time**(), **SSL\_get\_timeout**(), and **SSL\_set\_timeout**() functions are synonyms for the **SSL\_SESSION\_\***() counterparts.

Sessions are expired by examining the creation time and the timeout value. Both are set at creation time of the session to the actual time and the default timeout value at creation, respectively, as set by SSL\_CTX\_set\_timeout(3). Using these functions it is possible to extend or shorten the lifetime of the session.

## 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 function is passed the NULL pointer for the session *s*, 0 is returned.

## SEE ALSO

[ssl(3)](/ssl/3.md), SSL\_CTX\_set\_timeout(3), SSL\_get\_default\_timeout(3), SSL\_get\_session(3), SSL\_SESSION\_has\_ticket(3), SSL\_SESSION\_new(3)

## HISTORY

**SSL\_get\_time**(), **SSL\_get\_timeout**(), and **SSL\_set\_timeout**() appeared in SSLeay 0.4 or earlier. **SSL\_set\_time**() first appeared in SSLeay 0.5.2. **SSL\_SESSION\_get\_time**(), **SSL\_SESSION\_set\_time**(), **SSL\_SESSION\_get\_timeout**(), and **SSL\_SESSION\_set\_timeout**() first appeared in SSLeay 0.9.0. All these functions have been available since OpenBSD 2.4.
