ASN1C C/C++ Common Runtime  ASN1C v7.2.x
Functions
Time Helper Functions

Functions

int rtMakeGeneralizedTime (OSCTXT *pctxt, const OSNumDateTime *dateTime, char **outdata, size_t outdataSize)
 
int rtMakeUTCTime (OSCTXT *pctxt, const OSNumDateTime *dateTime, char **outdata, size_t outdataSize)
 
int rtParseGeneralizedTime (OSCTXT *pctxt, const char *value, OSNumDateTime *dateTime)
 
int rtParseUTCTime (OSCTXT *pctxt, const char *value, OSNumDateTime *dateTime)
 
void normalizeTimeZone (OSNumDateTime *pvalue)
 

Detailed Description

Utility functions for working with time strings in different formats. rtMake* functions create time strings, rtParse* functions parse time strings into the C OSNumDateTime structure defined in osSysTypes.h. Implementations of these functions exist for the ASN.1 GeneralizedTime and UTCTime formats.

Function Documentation

◆ normalizeTimeZone()

void normalizeTimeZone ( OSNumDateTime *  pvalue)

This function normalizes the time zone for the given datetime structure.

Parameters
pvalueA pointer-to an OSNumDateTime structure.

◆ rtMakeGeneralizedTime()

int rtMakeGeneralizedTime ( OSCTXT pctxt,
const OSNumDateTime *  dateTime,
char **  outdata,
size_t  outdataSize 
)

This function creates a time string in ASN.1 GeneralizedTime format as specified in the X.680 ITU-T standard.

Parameters
pctxtA pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
dateTimeA pointer to a date/time structure that contains components of the date and time.
outdataA pointer to a pointer to a destination string. If outdataSize is non-zero, it should be a pointer to a pointer to an actual array. Otherwise, the memory will be allocated and the pointer will be stored in the outdata.
outdataSizeA size of outdata (in octets). If zero, the memory for the outdata will be allocated. If not, the outdata 's size should be big enough to receive the generated time string. Otherwise, error code will be returned.
Returns
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

◆ rtMakeUTCTime()

int rtMakeUTCTime ( OSCTXT pctxt,
const OSNumDateTime *  dateTime,
char **  outdata,
size_t  outdataSize 
)

This function creates a time string in ASN.1 UTCTime format as specified in the X.680 ITU-T standard.

Parameters
pctxtA pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
dateTimeA pointer to a date/time structure that contains components of the date and time.
outdataA pointer to a pointer to a destination string. If outdataSize is non-zero, it should be a pointer to a pointer to an actual array. Otherwise, the memory will be allocated and the pointer will be stored in the outdata.
outdataSizeA size of outdata (in octets). If zero, the memory for the outdata will be allocated. If not, the outdata 's size should be big enough to receive the generated time string. Otherwise, error code will be returned.
Returns
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

◆ rtParseGeneralizedTime()

int rtParseGeneralizedTime ( OSCTXT pctxt,
const char *  value,
OSNumDateTime *  dateTime 
)

This function parses a time string that is represented in ASN.1 GeneralizedTime format as specified in the X.680 ITU-T standard. It stores the parsed result in a numeric date/time C structure.

Parameters
pctxtA pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
valueA pointer to the time string to be parsed.
dateTimeA pointer to the destination structure.
Returns
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

◆ rtParseUTCTime()

int rtParseUTCTime ( OSCTXT pctxt,
const char *  value,
OSNumDateTime *  dateTime 
)

This function parses a time string that is represented in ASN.1 UTCTime format as specified in the X.680 ITU-T standard. It stores the parsed result in a numeric date/time C structure.

Parameters
pctxtA pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
valueA pointer to the time string to be parsed.
dateTimeA pointer to the destination date/time structure.
Returns
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.