RSA BSAFE Micro Edition Suite

Streamlined security for mobile and embedded devices

Search  Print

Functions

This section details the time module functions used by applications requiring platform-independent time of day operations.

Functions

int R_CDECL R_TIME_CTX_new (R_LIB_CTX *lib_ctx, R_RES_FLAG flag, R_TIME_CTX **time_ctx)
 Allocates a new time module context. More...

int R_CDECL R_TIME_CTX_free (R_TIME_CTX *ctx)
 Deallocates a time module context object. More...

int R_CDECL R_TIME_new (R_TIME_CTX *ctx, R_TIME **time_p)
 Allocates a new time object. More...

int R_CDECL R_TIME_free (R_TIME *time_p)
 Deallocates a time module object. More...

int R_CDECL R_TIME_time (R_TIME *time_p)
 Stores the current time of day in the supplied time object. More...

int R_CDECL R_TIME_cmp (R_TIME *time1, R_TIME *time2, int *comp)
 Compares two time objects, time1 and time2. More...

int R_CDECL R_TIME_offset (R_TIME *time1, R_TIME *time2, long off)
 Adds an offset in seconds to the given time value and returns the result. More...

int R_CDECL R_TIME_export (R_TIME *time_p, int format, unsigned char *buf, unsigned int *len, unsigned int max_len)
 Converts from an internal time value to the format specified. More...

int R_CDECL R_TIME_import (R_TIME *time_p, int format, unsigned char *buf, unsigned int buf_len)
 Converts from the specified format to internal time. More...

int R_CDECL R_TIME_dup (R_TIME *f_time, R_TIME **d_time)
 Duplicates an R_TIME structure from an existing R_TIME structure f_time. More...


Function Documentation

int R_CDECL R_TIME_cmp R_TIME   time1,
R_TIME   time2,
int *    comp
;
 

Compares two time objects, time1 and time2.

Parameters:
time1 [In] The first time object reference.
time2 [In] The second time object reference.
comp [Out] The comparison result:
  • -1 indicates tm1 is prior to tm2.
  • >0 indicates tm1 is the same as tm2
  • 1 indicates tm1 is after tm2.
  • Returns:
    R_ERROR_NONE indicates success.
    See Identifiers for valid values.
    note.gif
    A NULL input for either time1 or time2 is considered to indicate time 0 (that is, EPOCH).
    Samples:
    ocsp_resp_vfy.c.

    int R_CDECL R_TIME_CTX_free R_TIME_CTX   time_ctx ;
     

    Deallocates a time module context object.

    Parameters:
    time_ctx [In] The time context reference.
    Returns:
    R_ERROR_NONE indicates success.
    See Identifiers for valid values.
    note.gif
    It is the calling function's responsibility to set the reference to NULL after the function has returned.
    Samples:
    cert_smpl.c, cm_sign_sm.c, ocsp_resp_vfy.c, req.c, and ss_cert_smpl.c.

    int R_CDECL R_TIME_CTX_new R_LIB_CTX   lib_ctx,
    R_RES_FLAG    flag,
    R_TIME_CTX **    time_ctx
    ;
     

    Allocates a new time module context.

    Parameters:
    lib_ctx [In] The library context.
    flag [In] The flag used in context creation.
    Only R_RES_FLAG_DEF is supported.
    time_ctx [Out] The allocated context reference.
    Returns:
    R_ERROR_NONE indicates success.
    See Identifiers for valid values.
    Samples:
    cert_smpl.c, cm_sign_sm.c, ocsp_resp_vfy.c, req.c, and ss_cert_smpl.c.

    int R_CDECL R_TIME_dup R_TIME   f_time,
    R_TIME **    d_time
    ;
     

    Duplicates an R_TIME structure from an existing R_TIME structure f_time.

    Parameters:
    f_time [In] The time structure to copy.
    d_time [Out] The time structure to create.
    Returns:
    R_ERROR_NONE indicates success.
    See Identifiers for valid values.
    Samples:
    cert_smpl.c, req.c, and ss_cert_smpl.c.

    int R_CDECL R_TIME_export R_TIME   time_p,
    int    format,
    unsigned char *    buf,
    unsigned int *    len,
    unsigned int    max_len
    ;
     

    Converts from an internal time value to the format specified.

    Parameters:
    time_p [In] The time object to export.
    format [In] The format of the output to generate.
    See Identifiers for valid values.
    buf [Out] The buffer to hold the result.
    len [Out] The amount of buf consumed.
    max_len [In] The length allocated to buf.
    Returns:
    R_ERROR_NONE indicates success.
    See Identifiers for valid values.
    Samples:
    cm_sign_sm.c, and ocsp_resp_vfy.c.

    int R_CDECL R_TIME_free R_TIME   time_p ;
     

    Deallocates a time module object.

    Parameters:
    time_p [In] The time object reference.
    Returns:
    R_ERROR_NONE for success.
    See Identifiers for valid values.
    note.gif
    It is the calling function's responsibility to set the reference to NULL after the function has returned.
    Samples:
    cert_smpl.c, cm_sign_sm.c, ocsp_resp_vfy.c, req.c, and ss_cert_smpl.c.

    int R_CDECL R_TIME_import R_TIME   time_p,
    int    format,
    unsigned char *    buf,
    unsigned int    buf_len
    ;
     

    Converts from the specified format to internal time.

    Parameters:
    time_p [Out] A pointer to destination time object.
    A NULL value causes the function to fail.
    format [In] The input format.
    See Identifiers for valid values.
    buf [In] The buffer containing formatted data for conversion.
    buf_len [In] The length of buf.
    Returns:
    R_ERROR_NONE indicates success.
    See Identifiers for valid values.
    Samples:
    ocsp_resp_vfy.c, and req.c.

    int R_CDECL R_TIME_new R_TIME_CTX   time_ctx,
    R_TIME **    time_p
    ;
     

    Allocates a new time object.

    Parameters:
    time_ctx [In] The time context reference.
    time_p [Out] The allocated time object reference.
    Returns:
    R_ERROR_NONE indicates success.
    See Identifiers for valid values.
    Samples:
    cert_smpl.c, cm_sign_sm.c, ocsp_resp_vfy.c, req.c, and ss_cert_smpl.c.

    int R_CDECL R_TIME_offset R_TIME   time1,
    R_TIME   time2,
    long    off
    ;
     

    Adds an offset in seconds to the given time value and returns the result.

    Parameters:
    time1 [Out] The return offset time.
    This can be the same as time2 if time2 is not NULL.
    time2 [In] The time to be offset.
    NULL is treated as EPOCH.
    off [In] The offset in seconds.
    It can be positive or negative.
    Returns:
    R_ERROR_NONE indicates success.
    See Identifiers for valid values.
    note.gif
    Underflow and overflow are not detected and may cause an undefined result in time1.
    Samples:
    cert_smpl.c, req.c, and ss_cert_smpl.c.

    int R_CDECL R_TIME_time R_TIME   time1 ;
     

    Stores the current time of day in the supplied time object.

    Parameters:
    time1 [In] The time object in which to store current time.
    Returns:
    R_ERROR_NONE indicates success.
    See Identifiers for valid values.
    Samples:
    cert_smpl.c, cm_sign_sm.c, ocsp_resp_vfy.c, req.c, and ss_cert_smpl.c.


    Copyright (c) 1999-2005 RSA Security Inc. All rights reserved. 072-001001-2100-001-000 - 2.1