ASN1C C/C++ Common Runtime  ASN1C v7.7.x
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ASN1CTime Class Referenceabstract

#include <ASN1CTime.h>

Inheritance diagram for ASN1CTime:
ASN1CType ASN1CGeneralizedTime ASN1CUTCTime

Public Types

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 Member Functions

EXTRTMETHOD ASN1CTime (OSRTMessageBufferIF &msgBuf, char *&buf, OSSIZE bufSize, OSBOOL useDerRules)
 
EXTRTMETHOD ASN1CTime (OSRTMessageBufferIF &msgBuf, ASN1VisibleString &buf, OSBOOL useDerRules)
 
EXTRTMETHOD ASN1CTime (OSRTContext &ctxt, char *&buf, OSSIZE bufSize, OSBOOL useDerRules)
 
EXTRTMETHOD ASN1CTime (OSRTContext &ctxt, ASN1VisibleString &buf, OSBOOL useDerRules)
 
EXTRTMETHOD ASN1CTime (const ASN1CTime &original)
 
EXTRTMETHOD ~ASN1CTime ()
 
virtual EXTRTMETHOD int getYear ()
 
virtual EXTRTMETHOD int getMonth ()
 
virtual EXTRTMETHOD int getDay ()
 
virtual EXTRTMETHOD int getHour ()
 
virtual EXTRTMETHOD int getMinute ()
 
virtual EXTRTMETHOD int getSecond ()
 
virtual EXTRTMETHOD int getFraction ()
 
virtual EXTRTMETHOD double getFractionAsDouble ()
 
virtual EXTRTMETHOD int getFractionStr (char *const pBuf, size_t bufSize)
 
virtual EXTRTMETHOD int getFractionLen ()
 
virtual EXTRTMETHOD int getDiffHour ()
 
virtual EXTRTMETHOD int getDiffMinute ()
 
virtual EXTRTMETHOD int getDiff ()
 
virtual EXTRTMETHOD OSBOOL getUTC ()
 
virtual EXTRTMETHOD time_t getTime ()
 
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 int setTime (time_t time, OSBOOL diffTime)=0
 
virtual EXTRTMETHOD int setDiffHour (short dhour)
 
virtual EXTRTMETHOD int setDiff (short dhour, short dminute)
 
virtual EXTRTMETHOD int setDiff (short inMinutes)
 
virtual EXTRTMETHOD int parseString (const char *string)
 
virtual EXTRTMETHOD void clear ()
 
virtual EXTRTMETHOD int equals (ASN1CTime &)
 
EXTRTMETHOD OSSIZE getTimeStringLen ()
 
EXTRTMETHOD const char * getTimeString (char *pbuf, OSSIZE bufsize)
 
EXTRTMETHOD const ASN1CTimeoperator= (const ASN1CTime &)
 
virtual EXTRTMETHOD OSBOOL operator== (ASN1CTime &)
 
virtual EXTRTMETHOD OSBOOL operator!= (ASN1CTime &)
 
virtual EXTRTMETHOD OSBOOL operator> (ASN1CTime &)
 
virtual EXTRTMETHOD OSBOOL operator< (ASN1CTime &)
 
virtual EXTRTMETHOD OSBOOL operator>= (ASN1CTime &)
 
virtual EXTRTMETHOD OSBOOL operator<= (ASN1CTime &)
 
- Public Member Functions inherited from ASN1CType
EXTRTMETHOD ASN1CType (OSRTMessageBufferIF &msgBuf)
 
EXTRTMETHOD ASN1CType (const ASN1CType &orig)
 
virtual ~ASN1CType ()
 
void append (OSRTDList &llist, void *pdata)
 
OSRTCtxtPtr getContext ()
 
OSCTXTgetCtxtPtr ()
 
char * getErrorText (char *textbuf=(char *) 0, OSSIZE bufsize=0)
 
int getStatus () const
 
void * memAlloc (OSSIZE numocts)
 
void * memAllocZ (OSSIZE numocts)
 
void memFreeAll ()
 
void * memRealloc (void *ptr, OSSIZE numocts)
 
void memReset ()
 
void memFreePtr (void *ptr)
 
void printErrorInfo ()
 
void resetError ()
 
OSBOOL setDiag (OSBOOL value)
 
virtual EXTRTMETHOD int Encode ()
 
virtual EXTRTMETHOD int Decode (OSBOOL free=FALSE)
 
virtual int EncodeTo (OSRTMessageBufferIF &)
 
virtual int DecodeFrom (OSRTMessageBufferIF &, OSBOOL free=TRUE)
 
virtual void MemFree ()
 

Protected Member Functions

EXTRTMETHOD void checkCapacity ()
 
EXTRTMETHOD char *& getTimeStringPtr ()
 
virtual ASN1TTimegetTimeObj ()=0
 
virtual const ASN1TTimegetTimeObj () const =0
 
EXTRTMETHOD ASN1CTime (char *&buf, OSSIZE bufSize, OSBOOL useDerRules)
 
EXTRTMETHOD ASN1CTime (ASN1VisibleString &buf, OSBOOL useDerRules)
 
virtual int compileString ()=0
 
- Protected Member Functions inherited from ASN1CType
EXTRTMETHOD ASN1CType ()
 
EXTRTMETHOD ASN1CType (OSRTContext &ctxt)
 
EXTRTMETHOD int setMsgBuf (OSRTMessageBufferIF &msgBuf, OSBOOL initBuf=FALSE)
 
EXTRTMETHOD int setRunTimeKey (const OSOCTET *key, OSSIZE keylen)
 

Protected Attributes

OSBOOL parsed
 
OSBOOL derRules
 
char *& timeStr
 
OSSIZE strSize
 
- Protected Attributes inherited from ASN1CType
OSRTCtxtPtr mpContext
 
OSRTMessageBufferIF * mpMsgBuf
 

Detailed Description

ASN.1 Time control base class. The ASN1CTime class is derived from the ASN1CType base class. It is used as the abstract base class for generated control classes for the ASN.1 Generalized Time ([UNIVERSAL 24] IMPLICIT VisibleString) types and Universal Time ([UNIVERSAL 23] IMPLICIT VisibleString) types. This class provides utility methods for operating on the time information referenced by the generated class. This class can also be used inline to operate on the times within generated time string elements in a SEQUENCE, SET, or CHOICE construct. The time string are generally formatted according to ISO 8601 format with some exceptions (X.680).

Constructor & Destructor Documentation

◆ ASN1CTime() [1/5]

EXTRTMETHOD ASN1CTime::ASN1CTime ( OSRTMessageBufferIF &  msgBuf,
char *&  buf,
OSSIZE  bufSize,
OSBOOL  useDerRules 
)

This constructor creates a time string from buffer.

It does not deep-copy the data; it just assigns the passed array to an internal reference variable. The object will then directly operate on the given data variable.

Parameters
msgBufReference to an OSRTMessage buffer derived object (for example, ASNBEREncodeBuffer).
bufReference to a pointer to a time string buffer.
bufSizeSize of buffer in bytes.
useDerRulesUse the Distinguished Encoding Rules (DER) to operate on this time value.

◆ ASN1CTime() [2/5]

EXTRTMETHOD ASN1CTime::ASN1CTime ( OSRTMessageBufferIF &  msgBuf,
ASN1VisibleString &  buf,
OSBOOL  useDerRules 
)

This constructor creates a time string from an ASN1VisibleString object.

It does not deep-copy the data; it just assigns the passed object to an internal reference variable. The object will then directly operate on the given data variable.

Parameters
msgBufReference to an OSRTMessage buffer derived object (for example, ASNBEREncodeBuffer).
bufReference to a visible string object to hold the time data.
useDerRulesUse the Distinguished Encoding Rules (DER) to operate on this time value.

◆ ASN1CTime() [3/5]

EXTRTMETHOD ASN1CTime::ASN1CTime ( OSRTContext ctxt,
char *&  buf,
OSSIZE  bufSize,
OSBOOL  useDerRules 
)

This constructor creates a time string from buffer.

It does not deep-copy the data; it just assigns the passed array to an internal reference variable. The object will then directly operate on the given data variable.

Parameters
ctxtReference to an OSRTContext data structure.
bufReference to a pointer to a time string buffer.
bufSizeSize of buffer in bytes.
useDerRulesUse the Distinguished Encoding Rules (DER) to operate on this time value.

◆ ASN1CTime() [4/5]

EXTRTMETHOD ASN1CTime::ASN1CTime ( OSRTContext ctxt,
ASN1VisibleString &  buf,
OSBOOL  useDerRules 
)

This constructor creates a time string from an ::ASN1VisibleString object.

It does not deep-copy the data; it just assigns the passed array to an internal reference variable. The object will then directly operate on the given data variable.

Parameters
ctxtReference to an OSRTContext data structure.
bufReference to a pointer to a time string buffer.
useDerRulesUse the Distinguished Encoding Rules (DER) to operate on this time value.

◆ ASN1CTime() [5/5]

EXTRTMETHOD ASN1CTime::ASN1CTime ( const ASN1CTime original)

The copy constructor. This does not deep-copy the original value. Instead, it assigns references to the internal components.

Parameters
originalThe original time string object value.

◆ ~ASN1CTime()

EXTRTMETHOD ASN1CTime::~ASN1CTime ( )

The destructor; this cleans up the ASN1CTime object.

Member Function Documentation

◆ clear()

virtual EXTRTMETHOD void ASN1CTime::clear ( )
virtual

This method clears the time string.

Note the action of this method may differ for different inherited ASN1CTime classes.

Parameters
-none
Returns
- none

◆ compileString()

virtual int ASN1CTime::compileString ( )
protectedpure virtual

Compiles new time string accoring X.680 and ISO 8601.

Returns
0 on success, or an error code if there was an error.

Implemented in ASN1CGeneralizedTime, and ASN1CUTCTime.

Referenced by ASN1CGeneralizedTime::ASN1CGeneralizedTime().

◆ equals()

virtual EXTRTMETHOD int ASN1CTime::equals ( ASN1CTime )
virtual

This method compares times.

◆ getDay()

virtual EXTRTMETHOD int ASN1CTime::getDay ( )
virtual

This method returns the day of month number component of the time value.

The number of the first day in the month is 1; the number of the last day may be in the interval from 28 to 31. Note that the return value may be differ for different inherited ASN1CTime classes.

Parameters
-none
Returns
Day of month component (1 - 31) is returned if the operation is successful. If the operation fails, a negative value is returned.

◆ getDiff()

virtual EXTRTMETHOD int ASN1CTime::getDiff ( )
virtual

This method returns the difference between the time zone of the object and the Coordinated Universal Time (UTC).

The UTC time is the sum of the local time and a positive of negative time difference. Note that the return value may differ for different inherited ASN1CTime classes.

Parameters
-none
Returns
The negative or positive minute component of the difference between the time zone of the object and the UTC time (-12*60 - +12*60) is returned if the operation is successful. If the operation fails, a negative value is returned.

◆ getDiffHour()

virtual EXTRTMETHOD int ASN1CTime::getDiffHour ( )
virtual

This method returns the hour component of the difference between the time zone of the object and the Coordinated Universal Time (UTC).

The UTC time is the sum of the local time and a positive of negative time difference. Note that the return value may differ for different inherited ASN1CTime classes.

Parameters
-none
Returns
The negative or positive hour component of the difference between the time zone of the object and the UTC time (-12 - +12) is returned if the operation is successful. If the operation fails, a negative value is returned.

◆ getDiffMinute()

virtual EXTRTMETHOD int ASN1CTime::getDiffMinute ( )
virtual

This method returns the minute component of the difference between the time zone of the object and the Coordinated Universal Time (UTC).

The UTC time is the sum of the local time and a positive of negative time difference. Note that the return value may differ for different inherited ASN1CTime classes.

Parameters
-none
Returns
The negative or positive minute component of the difference between the time zone of the object and the UTC time (-59 - +59) is returned if the operation is successful. If the operation fails, a negative value is returned.

◆ getFraction()

virtual EXTRTMETHOD int ASN1CTime::getFraction ( )
virtual

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. Note that the return value may differ for different inherited ASN1CTime classes.

Parameters
-none
Returns
Second's decimal fraction component (0 - 9) is returned if operation is successful. If the operation fails, a negative value is returned.

Reimplemented in ASN1CUTCTime.

◆ getFractionAsDouble()

virtual EXTRTMETHOD double ASN1CTime::getFractionAsDouble ( )
virtual

This method returns the second's decimal component of the time value. Second's fraction will be represented as double value more than 0 and less than 1.

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.

◆ getFractionLen()

virtual EXTRTMETHOD int ASN1CTime::getFractionLen ( )
virtual

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

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

◆ getFractionStr()

virtual EXTRTMETHOD int ASN1CTime::getFractionStr ( char *const  pBuf,
size_t  bufSize 
)
virtual

This method returns the second's decimal component of the time value. Second's fraction will be represented as string w/o integer part and decimal point.

Returns
Length of the fraction string returned in pBuf, if operation is successful. If the operation fails, a negative value is returned.

◆ getHour()

virtual EXTRTMETHOD int ASN1CTime::getHour ( )
virtual

This method returns the hour component of the time value.

As the ISO 8601 is based on the 24-hour timekeeping system, hours are represented by two-digit values from 00 to 23. Note that the return value may differ from different inherited ASN1CTime classes.

Parameters
-none
Returns
Hour component (0 - 23) is returned if the operation is successful. If the operation fails, a negative value is returned.

◆ getMinute()

virtual EXTRTMETHOD int ASN1CTime::getMinute ( )
virtual

This method returns the minute component of the time value.

Minutes are represented by the two digits from 00 to 59. Note that the return value may differ from different inherited ASN1CTime classes.

Parameters
-none
Returns
Minute component (0 - 59) is returned if the operation is successful. If the operation fails, a negative value is returned.

◆ getMonth()

virtual EXTRTMETHOD int ASN1CTime::getMonth ( )
virtual

This method returns the month number component of the time value.

The number of January is 1, February 2, ... up to December 12. You may also use enumerated valued for decoded months: ASN1CTime::January, ASN1CTime::February, etc. Also short aliases for months can be used: ASN1CTime::Jan, ASN1CTime::Feb, etc. Note that the return value may differ for different inherited ASN1CTime classes.

Parameters
-none
Returns
Month component (1 - 12) is returned if operation is successful. If the operation fails, a negative value is returned.

◆ getSecond()

virtual EXTRTMETHOD int ASN1CTime::getSecond ( )
virtual

This method returns the second component of the time value.

Seconds are represented by two digits from 00 to 59. Note that the return value may differ from different inherited ASN1CTime classes.

Parameters
-none
Returns
Second component (0 - 59) is returned if the operation is successful. If the operation fails, a negative value is returned.

◆ getTime()

virtual EXTRTMETHOD time_t ASN1CTime::getTime ( )
virtual

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

The value is the number of seconds from January 1, 1970. If the time is represned as UTC time plus or minus a time difference, then the resulting value will be recalculated as local time. For example, if the time string is "19991208120000+0930", then this string will be converted to "19991208213000" and then converted to a time_t value. Note that the return value may differ for different inherited ASN1CTime classes.

Parameters
-none
Returns
The time value, expressed as a number of seconds from January 1, 1970. If the operation fails, a negative value is returned.

◆ getTimeString()

EXTRTMETHOD const char* ASN1CTime::getTimeString ( char *  pbuf,
OSSIZE  bufsize 
)

This method copies the compiled time string into the given buffer.

Parameters
pbufThe buffer to receive the time string.
bufsizeThe size of the buffer.
Returns
A character string containing the compiled time string.

◆ getTimeStringLen()

EXTRTMETHOD OSSIZE ASN1CTime::getTimeStringLen ( )

This method returns the length of the compiled time string.

Returns
The length of the compiled time string.

◆ getUTC()

virtual EXTRTMETHOD OSBOOL ASN1CTime::getUTC ( )
virtual

This method returns the UTC flag state.

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

Parameters
-none
Returns
UTC flag state is returned.

◆ getYear()

virtual EXTRTMETHOD int ASN1CTime::getYear ( )
virtual

This method returns the year component of the time value.

Note that the return value may differ for different inherited ASN1CTime classes.

Parameters
-none
Returns
Year component (full 4 digits) is returned if the operation is successful. If the operation fails, a negative value is returned.

◆ operator!=()

virtual EXTRTMETHOD OSBOOL ASN1CTime::operator!= ( ASN1CTime )
virtual

The ASN1CTime inequality test.

Returns
TRUE if the two times are not equal.

◆ operator<()

virtual EXTRTMETHOD OSBOOL ASN1CTime::operator< ( ASN1CTime )
virtual

The ASN1CTime less-than test.

Returns
TRUE if this time is less than the given time.

◆ operator<=()

virtual EXTRTMETHOD OSBOOL ASN1CTime::operator<= ( ASN1CTime )
virtual

The ASN1CTime less-equal test.

Returns
TRUE if this time is less-than or equal to the given time.

◆ operator=()

EXTRTMETHOD const ASN1CTime& ASN1CTime::operator= ( const ASN1CTime )

This operator assigns this ASN1CTime object to the given ASN1CTime reference.

Returns
A constant reference to the given ASN1CTime object.

Referenced by ASN1CGeneralizedTime::ASN1CGeneralizedTime().

◆ operator==()

virtual EXTRTMETHOD OSBOOL ASN1CTime::operator== ( ASN1CTime )
virtual

The ASN1CTime equality test.

Returns
TRUE if the two times are equal.

◆ operator>()

virtual EXTRTMETHOD OSBOOL ASN1CTime::operator> ( ASN1CTime )
virtual

The ASN1CTime greater-than test.

Returns
TRUE if this time is greater than the given time.

◆ operator>=()

virtual EXTRTMETHOD OSBOOL ASN1CTime::operator>= ( ASN1CTime )
virtual

The ASN1CTime greater-equal test.

Returns
TRUE if this time is greater-than or equal to the given time.

◆ parseString()

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

This method parses the given time string.

The string is expected to be in the ASN.1 value notation format for the given ASN.1 time string type. Note that the action of this method may differ for different inherited ASN1CTime classes.

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

◆ setDay()

virtual EXTRTMETHOD int ASN1CTime::setDay ( short  day_)
virtual

This method sets the day of month number component of the time value.

The number of the first day in the month is 1; the number of the last day in the month may be in the interval from 28 to 31. Note that the action of this method may differ for different inherited ASN1CTime classes.

Parameters
day_Day of month component (1 - 31).
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ setDER()

void ASN1CTime::setDER ( OSBOOL  bvalue)
inline

This method sets the 'use DER' flag which enforces the DER rules when time strings are constructed or parsed.

References operator!=(), operator<(), operator<=(), operator==(), operator>(), and operator>=().

◆ setDiff() [1/2]

virtual EXTRTMETHOD int ASN1CTime::setDiff ( short  dhour,
short  dminute 
)
virtual

This method sets the hours and the minute components of the difference between the time zone of the object and Coordinated Universal Time (UTC).

The UTC time is the sum of the local time and a positive or negative time difference. Note that the action of this method may differ for different inherited ASN1CTime classes.

Parameters
dhourThe negative or positive hour component of the difference between the time zone of the object and the UTC time (-12 - +12).
dminuteThe negative or positive minute component of the difference between the time zone of the object and the UTC time (-59 - +59).
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ setDiff() [2/2]

virtual EXTRTMETHOD int ASN1CTime::setDiff ( short  inMinutes)
virtual

This method sets the difference between the time zone of the object and Coordinated Universal Time (UTC), in minutes.

The UTC time is the sum of the local time and a positive or negative time difference. Note that the action of this method may differ for different inherited ASN1CTime classes.

Parameters
inMinutesThe negative or positive difference, in minutes, between the time zone of the object and the UTC time (-12*60 - +12*60) is returned if the operation is successful.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ setDiffHour()

virtual EXTRTMETHOD int ASN1CTime::setDiffHour ( short  dhour)
virtual

This method sets teh hour component of the difference between the time zone of the object and the Coordinated Universal Time (UTC).

The UTC time is the sum of the local time and a positive or negative time difference. Note that the action of this method may differ from different inherited ASN1CTime classes.

Parameters
dhourThe negative or positive hour component of the difference between the time zone of the object and the UTC time (-12 - +12) is returned if the operation is successful. If the operation fails, a negative value is returned.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ setFraction() [1/3]

virtual EXTRTMETHOD int ASN1CTime::setFraction ( int  fraction,
int  fracLen = -1 
)
virtual

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 ASN1CTime 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 (0) = success,
  • negative return value is error.

◆ setFraction() [2/3]

virtual EXTRTMETHOD int ASN1CTime::setFraction ( double  frac,
int  fracLen 
)
virtual

This method sets the second's decimal fraction component of the time value. Double value must be greater or equal 0 and less than 1.

Parameters
fracSecond's decimal fraction component.
fracLenSpecifies number of digits in second's fraction.
Returns
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

◆ setFraction() [3/3]

virtual EXTRTMETHOD int ASN1CTime::setFraction ( char const *  frac)
virtual

This method sets the second's decimal fraction component of the time value. Double value must be greater or equal 0 and less than 1.

Parameters
fracSecond's decimal fraction component.
Returns
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

◆ setHour()

virtual EXTRTMETHOD int ASN1CTime::setHour ( short  hour_)
virtual

This method sets the hour component of the time value.

As the ISO 8601 is based on the 24-hour timekeeping system, hours are represented by two digits from 00 to 23. Note that the action of this method may differ for different inherited ASN1CTime classes.

Parameters
hour_Hour component (0 - 23).
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ setMinute()

virtual EXTRTMETHOD int ASN1CTime::setMinute ( short  minute_)
virtual

This method sets the minute component of the time value.

Minutes are represented by two digits from 00 to 59. Note that the action of this method may differ for different inherited ASN1CTime classes.

Parameters
minute_Minute component (0 - 59).
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ setMonth()

virtual EXTRTMETHOD int ASN1CTime::setMonth ( short  month_)
virtual

This method sets the month number component of the time value.

The number of January is 1, February 2, ..., through December 12. You may use enumerated values for months encoding: ASN1CTime::January, ASN1CTime::February, etc. Also you can use short aliases for months: ASN1CTime::Jan, ASN1CTime::Feb, etc. Note that the action of this method may differ for different inherited ASN1CTime classes.

Parameters
month_Month component (1 - 12).
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ setSecond()

virtual EXTRTMETHOD int ASN1CTime::setSecond ( short  second_)
virtual

This method sets the second component of the time value.

Seconds are represented by two digits from 00 to 59. Note that the action of this method may differ form different inherited ASN1CTime classes.

Parameters
second_Second component (0 - 59).
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ setTime()

virtual int ASN1CTime::setTime ( time_t  time,
OSBOOL  diffTime 
)
pure 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. Note that the action of this method may differ for different inherited ASN1CTime Classes.

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.

Implemented in ASN1CGeneralizedTime, and ASN1CUTCTime.

Referenced by ASN1CGeneralizedTime::ASN1CGeneralizedTime().

◆ setUTC()

virtual EXTRTMETHOD int ASN1CTime::setUTC ( OSBOOL  utc)
virtual

This method sets teh 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.

◆ setYear()

virtual EXTRTMETHOD int ASN1CTime::setYear ( short  year_)
virtual

This method sets the year component of the time value.

Note that the action of this method may differ for different inherited ASN1CTime classes.

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

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