ASN1C C/C++ Common Runtime  ASN1C v7.8.x
Public Member Functions | List of all members
ASN1TGeneralizedTime Class Reference

#include <ASN1TTime.h>

Inheritance diagram for ASN1TGeneralizedTime:
ASN1TTime

Public Member Functions

 ASN1TGeneralizedTime ()
 
EXTRTMETHOD ASN1TGeneralizedTime (const char *buf, OSBOOL useDerRules=FALSE)
 
 ASN1TGeneralizedTime (OSBOOL useDerRules)
 
 ASN1TGeneralizedTime (const ASN1TGeneralizedTime &original)
 
EXTRTMETHOD int getCentury () const
 
EXTRTMETHOD int setCentury (short century)
 
EXTRTMETHOD int setTime (time_t time, OSBOOL diffTime)
 
EXTRTMETHOD int parseString (const char *string)
 
const ASN1TGeneralizedTimeoperator= (const ASN1TGeneralizedTime &tm)
 
EXTRTMETHOD int compileString (char *pbuf, OSSIZE bufsize) const
 
- Public Member Functions inherited from ASN1TTime
EXTRTMETHOD ASN1TTime ()
 
EXTRTMETHOD ASN1TTime (OSBOOL useDerRules)
 
EXTRTMETHOD ASN1TTime (const ASN1TTime &original)
 
virtual EXTRTMETHOD ~ASN1TTime ()
 
virtual EXTRTMETHOD int getYear () const
 
virtual EXTRTMETHOD int getMonth () const
 
virtual EXTRTMETHOD int getDay () const
 
virtual EXTRTMETHOD int getHour () const
 
virtual EXTRTMETHOD int getMinute () const
 
virtual EXTRTMETHOD int getSecond () const
 
virtual EXTRTMETHOD int getFraction () const
 
virtual EXTRTMETHOD double getFractionAsDouble () const
 
virtual EXTRTMETHOD int getFractionStr (char *const pBuf, OSSIZE bufSize) const
 
virtual EXTRTMETHOD int getFractionLen () const
 
virtual EXTRTMETHOD int getDiffHour () const
 
virtual EXTRTMETHOD int getDiffMinute () const
 
virtual EXTRTMETHOD int getDiff () const
 
virtual EXTRTMETHOD OSBOOL getUTC () const
 
virtual EXTRTMETHOD time_t getTime () const
 
void setDER (OSBOOL bvalue)
 
virtual EXTRTMETHOD int setUTC (OSBOOL utc)
 
virtual EXTRTMETHOD int setYear (short year_)
 
virtual EXTRTMETHOD int setMonth (short month_)
 
virtual EXTRTMETHOD int setDay (short day_)
 
virtual EXTRTMETHOD int setHour (short hour_)
 
virtual EXTRTMETHOD int setMinute (short minute_)
 
virtual EXTRTMETHOD int setSecond (short second_)
 
virtual EXTRTMETHOD int setFraction (int fraction, int fracLen=-1)
 
virtual EXTRTMETHOD int setFraction (double frac, int fracLen)
 
virtual EXTRTMETHOD int setFraction (char const *frac)
 
virtual EXTRTMETHOD int setDiffHour (short dhour)
 
virtual EXTRTMETHOD int setDiff (short dhour, short dminute)
 
virtual EXTRTMETHOD int setDiff (short inMinutes)
 
virtual EXTRTMETHOD void clear ()
 
virtual EXTRTMETHOD int equals (const ASN1TTime &) const
 
EXTRTMETHOD const char * toString (char *pbuf, OSSIZE bufsize) const
 
EXTRTMETHOD char * toString (OSCTXT *pctxt) const
 
EXTRTMETHOD char * toString () const
 
EXTRTMETHOD const ASN1TTimeoperator= (const ASN1TTime &)
 
virtual EXTRTMETHOD OSBOOL operator== (const ASN1TTime &) const
 
virtual EXTRTMETHOD OSBOOL operator!= (const ASN1TTime &) const
 
virtual EXTRTMETHOD OSBOOL operator> (const ASN1TTime &) const
 
virtual EXTRTMETHOD OSBOOL operator< (const ASN1TTime &) const
 
virtual EXTRTMETHOD OSBOOL operator>= (const ASN1TTime &) const
 
virtual EXTRTMETHOD OSBOOL operator<= (const ASN1TTime &) const
 

Additional Inherited Members

- Public Types inherited from ASN1TTime
enum  {
  January = 1, Jan = 1, February = 2, Feb = 2,
  March = 3, Mar = 3, April = 4, Apr = 4,
  May = 5, June = 6, Jun = 6, July = 7,
  Jul = 7, August = 8, Aug = 8, September = 9,
  Sep = 9, October = 10, Oct = 10, November = 11,
  Nov = 11, December = 12, Dec = 12
}
 
- Public Attributes inherited from ASN1TTime
short mYear
 
short mMonth
 
short mDay
 
short mHour
 
short mMinute
 
short mSecond
 
short mDiffHour
 
short mDiffMin
 
int mSecFraction
 
int mSecFracLen
 
int mStatus
 
OSBOOL mbUtcFlag
 
OSBOOL mbDerRules
 
- Protected Member Functions inherited from ASN1TTime
EXTRTMETHOD void privateInit ()
 
EXTRTMETHOD int getDaysNum () const
 
EXTRTMETHOD long getMillisNum () const
 
int ncharsToInt (const char *str, OSSIZE nchars, int &value)
 
- Static Protected Member Functions inherited from ASN1TTime
static EXTRTMETHOD int checkDate (int day, int month, int year)
 
static EXTRTMETHOD void addMilliseconds (int deltaMs, short &year, short &month, short &day, short &hour, short &minute, short &second, int &secFraction, int secFracLen)
 
static EXTRTMETHOD void addDays (int deltaDays, short &year, short &month, short &day)
 
static EXTRTMETHOD short daysInMonth (int i)
 
static EXTRTMETHOD int daysAfterMonth (int i)
 

Detailed Description

ASN.1 GeneralizedTime utility class. The ASN1TGeneralizedTime class is derived from the ASN1TTime base class.

Constructor & Destructor Documentation

◆ ASN1TGeneralizedTime() [1/4]

ASN1TGeneralizedTime::ASN1TGeneralizedTime ( )
inline

A default constructor.

◆ ASN1TGeneralizedTime() [2/4]

EXTRTMETHOD ASN1TGeneralizedTime::ASN1TGeneralizedTime ( const char *  buf,
OSBOOL  useDerRules = FALSE 
)

This constructor creates a time object using the specified time string.

Parameters
bufA pointer to the time string to be parsed.
useDerRulesAn OSBOOL value.

◆ ASN1TGeneralizedTime() [3/4]

ASN1TGeneralizedTime::ASN1TGeneralizedTime ( OSBOOL  useDerRules)
inline

This constructor creates an empty time object.

Parameters
useDerRulesAn OSBOOL value.

◆ ASN1TGeneralizedTime() [4/4]

ASN1TGeneralizedTime::ASN1TGeneralizedTime ( const ASN1TGeneralizedTime original)
inline

Member Function Documentation

◆ compileString()

EXTRTMETHOD int ASN1TGeneralizedTime::compileString ( char *  pbuf,
OSSIZE  bufsize 
) const
virtual

Compiles new time string accoring X.680 and ISO 8601. Returns 0, if succeed, or error code, if error.

Parameters
pbufA pointer to destination buffer.
bufsizeA size of destination buffer.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

Implements ASN1TTime.

◆ getCentury()

EXTRTMETHOD int ASN1TGeneralizedTime::getCentury ( ) const

This method returns the centry part (first two digits) of the year component of the time value.

Returns
Century part (first two digits) of the year component is returned if the operation is sucessful. If the operation fails, one of the negative status codes is returned.

◆ parseString()

EXTRTMETHOD int ASN1TGeneralizedTime::parseString ( const char *  string)
virtual

Parses sting.

Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

Implements ASN1TTime.

◆ setCentury()

EXTRTMETHOD int ASN1TGeneralizedTime::setCentury ( short  century)

This method sets the centry part (first two digits) of the year component of the time value.

Parameters
centuryCentury part (first two digits) of the year component.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ setTime()

EXTRTMETHOD int ASN1TGeneralizedTime::setTime ( time_t  time,
OSBOOL  diffTime 
)
virtual

This converts the value of the C built-in type time_t to a time string.

The value is the number of seconds from January 1, 1970.

Parameters
timeThe time value, expressed as a number of seconds from January 1, 1970.
diffTimeTRUE means the difference between local time and UTC time will be calculated; in other case, only local time will be stored.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

Implements ASN1TTime.


The documentation for this class was generated from the following file: