Objective Systems, Inc.  
Home
About ASN.1
Products
Free Software
Documents
Services
Resources
Resellers
Customers
Careers
About Us
Contact Us
 

Google


Objective Systems, Inc.

Time Helper Functions
[C Runtime Common Functions]


Detailed Description

These are helper functions for work with time strings in different formats. rtMake* functions create time strings, rtParse* ones parse time string into the C structure OSDATETIME. There are implementations of these functions for ASN.1 GeneralizedTime, UTCTime and XML dateTime formats.


Functions

int rtMakeGeneralizedTime (ASN1CTXT *pctxt, const OSDATETIME *dateTime, char **outdata, int outdataSize)
int rtMakeUTCTime (ASN1CTXT *pctxt, const OSDATETIME *dateTime, char **outdata, int outdataSize)
int rtMakeXmlDateTime (ASN1CTXT *pctxt, const OSDATETIME *dateTime, char **outdata, int outdataSize)
int rtParseGeneralizedTime (ASN1CTXT *pctxt, ASN1ConstCharPtr value, OSDATETIME *dateTime)
int rtParseUTCTime (ASN1CTXT *pctxt, ASN1ConstCharPtr value, OSDATETIME *dateTime)
int rtParseXmlDateTime (ASN1CTXT *pctxt, ASN1ConstCharPtr value, OSDATETIME *dateTime)


Function Documentation

int rtMakeGeneralizedTime ASN1CTXT *  pctxt,
const OSDATETIME *  dateTime,
char **  outdata,
int  outdataSize
 

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

Parameters:
pctxt A 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.
dateTime A pointer to the OSDATETIME structure, that contains components of the date and time.
outdata A 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.
outdataSize A 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.

int rtMakeUTCTime ASN1CTXT *  pctxt,
const OSDATETIME *  dateTime,
char **  outdata,
int  outdataSize
 

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

Parameters:
pctxt A 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.
dateTime A pointer to the OSDATETIME structure, that contains components of the date and time.
outdata A 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.
outdataSize A 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.

int rtMakeXmlDateTime ASN1CTXT *  pctxt,
const OSDATETIME *  dateTime,
char **  outdata,
int  outdataSize
 

This function creates a time string in XML dateTime format as specified in the XML schema W3C Recommendation.

Parameters:
pctxt A 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.
dateTime A pointer to the OSDATETIME structure, that contains components of the date and time.
outdata A 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.
outdataSize A 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.

int rtParseGeneralizedTime ASN1CTXT *  pctxt,
ASN1ConstCharPtr  value,
OSDATETIME *  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 parsing result in OSDATETIME C structure.

Parameters:
pctxt A 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.
value A pointer to the time string to be parsed.
dateTime A pointer to the destination OSDATETIME structure.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

int rtParseUTCTime ASN1CTXT *  pctxt,
ASN1ConstCharPtr  value,
OSDATETIME *  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 parsing result in OSDATETIME C structure.

Parameters:
pctxt A 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.
value A pointer to the time string to be parsed.
dateTime A pointer to the destination OSDATETIME structure.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

int rtParseXmlDateTime ASN1CTXT *  pctxt,
ASN1ConstCharPtr  value,
OSDATETIME *  dateTime
 

This function parses a time string that is represented in XML dateTime format as specified in the XML schema W3C Recommendation. It stores the parsing result in OSDATETIME C structure.

Parameters:
pctxt A 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.
value A pointer to the time string to be parsed.
dateTime A pointer to the destination OSDATETIME structure.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.


Copyright © 1997-2004 Objective Systems,Inc.
All Rights Reserved.
This document may be distributed in any form, electronic
or otherwise, provided that it is distributed in its entirety
and that the copyright and this notice are included.

This file was last modified on 1 Oct 2004.
ASN1C C/C++ Common Runtime, ASN1C v5.7x