ASN1C C/C++ Common Runtime  ASN1C v7.7.x
Public Member Functions | Protected Member Functions | List of all members
ASN1TUTCTime Class Reference

#include <ASN1TTime.h>

Inheritance diagram for ASN1TUTCTime:
ASN1TTime

Public Member Functions

EXTRTMETHOD ASN1TUTCTime ()
 
EXTRTMETHOD ASN1TUTCTime (const char *timeStr, OSBOOL useDerRules=FALSE)
 
EXTRTMETHOD ASN1TUTCTime (OSBOOL useDerRules)
 
 ASN1TUTCTime (const ASN1TUTCTime &original)
 
EXTRTMETHOD int setYear (short year_)
 
EXTRTMETHOD int setTime (time_t time, OSBOOL diffTime)
 
EXTRTMETHOD int setUTC (OSBOOL utc)
 
EXTRTMETHOD void clear ()
 
EXTRTMETHOD int compileString (char *pbuf, OSSIZE bufsize) const
 
EXTRTMETHOD int parseString (const char *string)
 
const ASN1TUTCTimeoperator= (const ASN1TUTCTime &tm)
 
- 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 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 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 (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 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
 

Protected Member Functions

EXTRTMETHOD int getFraction () const
 
EXTRTMETHOD int setFraction (int fraction, int fracLen=-1)
 
- 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)
 

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
 
- 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 UTCTime utility class. The ASN1TUTTime class is derived from the ASN1TTime base class.

Constructor & Destructor Documentation

◆ ASN1TUTCTime() [1/4]

EXTRTMETHOD ASN1TUTCTime::ASN1TUTCTime ( )

A default constructor.

◆ ASN1TUTCTime() [2/4]

EXTRTMETHOD ASN1TUTCTime::ASN1TUTCTime ( const char *  timeStr,
OSBOOL  useDerRules = FALSE 
)

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

Parameters
timeStrA pointer to the time string to be parsed.
useDerRulesCreate object using DER rules.

◆ ASN1TUTCTime() [3/4]

EXTRTMETHOD ASN1TUTCTime::ASN1TUTCTime ( OSBOOL  useDerRules)

This constructor creates an empty time object.

Parameters
useDerRulesAn OSBOOL value.

◆ ASN1TUTCTime() [4/4]

ASN1TUTCTime::ASN1TUTCTime ( const ASN1TUTCTime original)
inline

Member Function Documentation

◆ clear()

EXTRTMETHOD void ASN1TUTCTime::clear ( )
virtual

Clears out the time object.

Reimplemented from ASN1TTime.

◆ compileString()

EXTRTMETHOD int ASN1TUTCTime::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.

◆ getFraction()

EXTRTMETHOD int ASN1TUTCTime::getFraction ( ) const
protectedvirtual

This method returns the second's decimal component of the time value.

Second's decimal fraction is represented by one or more digits from 0 to 9.

Returns
Second's decimal fraction component is returned if operation is successful. If the operation fails, a negative value is returned.

Reimplemented from ASN1TTime.

◆ parseString()

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

Parses the given time string. The string is assumed to be in standard UTC time format.

Parameters
stringUTC time string to be parsed.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

Implements ASN1TTime.

◆ setFraction()

EXTRTMETHOD int ASN1TUTCTime::setFraction ( int  fraction,
int  fracLen = -1 
)
protectedvirtual

This method sets the second's decimal fraction component of the time value.

Second's decimal fraction is represented by one or more digits from 0 to 9. Note that the action of this method may differ for different inherited ASN1TTime classes.

Parameters
fractionSecond's decimal fraction component (0 - 9).
fracLenOptional parameter specifies number of digits in second's fraction.
Returns
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

Reimplemented from ASN1TTime.

◆ setTime()

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

Converts time_t to time string.

Parameters
timetime to convert,
diffTimeTRUE means the difference between local time and UTC 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.

◆ setUTC()

EXTRTMETHOD int ASN1TUTCTime::setUTC ( OSBOOL  utc)
virtual

This method sets the UTC flag state.

If the UTC flag is TRUE, then the time is a UTC time and symbol 'Z' is added to the end of the string. Otherwise, it is a local time.

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

Reimplemented from ASN1TTime.

◆ setYear()

EXTRTMETHOD int ASN1TUTCTime::setYear ( short  year_)
virtual

This method sets the year component of the time value.

The year parameter can be either the two last digits of the year (00 - 99) or the full four digits (0 - 9999). Note: the getYear method returns the year in the full four digits, independent of the format of the year parameter used in this method.

Parameters
year_Year component (full four digits or only last two digits).
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

Reimplemented from ASN1TTime.


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