logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

OPENSSL_gmtime, OPENSSL_gmtime_adj, OPENSSL_gmtime_diff - platform-agnostic OpenSSL time routines

Description

OPENSSL_gmtime() returns the UTC time specified by timer into the provided result argument.

       OPENSSL_gmtime_adj() adds the offsets in offset_day and offset_sec to tm.

       OPENSSL_gmtime_diff() calculates the difference between from and to.

History

OPENSSL_gmtime(), OPENSSL_gmtime_adj() and OPENSSL_gmtime_diff() have been in OpenSSL since 1.0.0.

Name

       OPENSSL_gmtime, OPENSSL_gmtime_adj, OPENSSL_gmtime_diff - platform-agnostic OpenSSL time routines

Notes

       It is an error to call OPENSSL_gmtime() with result equal to NULL. 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 structtm specified by tm. Leap seconds are not considered.

       OPENSSL_gmtime_diff() calculates the difference between the two structtm structures from and to. The
       difference in days is placed into *pday, the remaining seconds are placed to *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.

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);

See Also