ASN1C C/C++ Common Runtime
ASN1C v7.4.x
|
#include <ASN1TTime.h>
Public Member Functions | |
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 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 int | parseString (const char *string)=0 |
virtual EXTRTMETHOD void | clear () |
virtual int | compileString (char *pbuf, OSSIZE bufsize) const =0 |
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 ASN1TTime & | operator= (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 |
Public Attributes | |
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 | |
EXTRTMETHOD void | privateInit () |
EXTRTMETHOD int | getDaysNum () const |
EXTRTMETHOD long | getMillisNum () const |
int | ncharsToInt (const char *str, OSSIZE nchars, int &value) |
ASN.1 Time utility base class.
EXTRTMETHOD ASN1TTime::ASN1TTime | ( | ) |
This constructpor creates an empty time class.
EXTRTMETHOD ASN1TTime::ASN1TTime | ( | OSBOOL | useDerRules | ) |
This constructor creates an empty time class.
useDerRules | Use the Distinguished Encoding Rules (DER) to operate on this time value. |
EXTRTMETHOD ASN1TTime::ASN1TTime | ( | const ASN1TTime & | original | ) |
The copy constructor.
original | The original time string object value. |
|
virtual |
The destructor.
|
virtual |
This method clears the time object.
Note the action of this method may differ for different inherited ASN1TTime classes.
Reimplemented in ASN1TUTCTime.
Referenced by ASN1TUTCTime::ASN1TUTCTime().
|
pure virtual |
Compiles new time string accoring X.680 and ISO 8601. Returns 0, if succeed, or error code, if error.
pbuf | A pointer to destination buffer. |
bufsize | A size of destination buffer. |
Implemented in ASN1TUTCTime, and ASN1TGeneralizedTime.
Referenced by ASN1TGeneralizedTime::ASN1TGeneralizedTime(), and ASN1TUTCTime::ASN1TUTCTime().
|
virtual |
This method compares times.
|
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 ASN1TTime classes.
|
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 ASN1TTime classes.
|
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 ASN1TTime classes.
|
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 ASN1TTime classes.
|
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.
Reimplemented in ASN1TUTCTime.
Referenced by ASN1TUTCTime::ASN1TUTCTime().
|
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.
|
virtual |
This method returns the number of digits in second's decimal component of the time value.
|
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.
|
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 ASN1TTime classes.
|
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 ASN1TTime classes.
|
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: ASN1TTime::January, ASN1TTime::February, etc. Also short aliases for months can be used: ASN1TTime::Jan, ASN1TTime::Feb, etc. Note that the return value may differ for different inherited ASN1TTime classes.
|
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 ASN1TTime classes.
|
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 ASN1TTime classes.
|
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.
|
virtual |
This method returns the year component of the time value.
Note that the return value may differ for different inherited ASN1TTime classes.
|
pure 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 ASN1TTime classes.
string | The time string value to be parsed. |
Implemented in ASN1TUTCTime, and ASN1TGeneralizedTime.
Referenced by ASN1TGeneralizedTime::ASN1TGeneralizedTime(), and ASN1TUTCTime::ASN1TUTCTime().
|
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 ASN1TTime classes.
day_ | Day of month component (1 - 31). |
|
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>=().
|
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 ASN1TTime classes.
dhour | The negative or positive hour component of the difference between the time zone of the object and the UTC time (-12 - +12). |
dminute | The negative or positive minute component of the difference between the time zone of the object and the UTC time (-59 - +59). |
|
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 ASN1TTime classes.
inMinutes | The 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. |
|
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 ASN1TTime classes.
dhour | 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. |
|
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 ASN1TTime classes.
fraction | Second's decimal fraction component (0 - 9). |
fracLen | Optional parameter specifies number of digits in second's fraction. |
Reimplemented in ASN1TUTCTime.
Referenced by ASN1TUTCTime::ASN1TUTCTime().
|
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.
frac | Second's decimal fraction component. |
fracLen | Specifies number of digits in second's fraction. |
|
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.
frac | Second's decimal fraction component. |
|
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 ASN1TTime classes.
hour_ | Hour component (0 - 23). |
|
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 ASN1TTime classes.
minute_ | Minute component (0 - 59). |
|
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: ASN1TTime::January, ASN1TTime::February, etc. Also you can use short aliases for months: ASN1TTime::Jan, ASN1TTime::Feb, etc. Note that the action of this method may differ for different inherited ASN1TTime classes.
month_ | Month component (1 - 12). |
|
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 ASN1TTime classes.
second_ | Second component (0 - 59). |
|
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 ASN1TTime Classes.
time | The time value, expressed as a number of seconds from January 1, 1970. |
diffTime | TRUE means the difference between local time and UTC time will be calculated; in other case, only local time will be stored. |
Implemented in ASN1TUTCTime, and ASN1TGeneralizedTime.
Referenced by ASN1TGeneralizedTime::ASN1TGeneralizedTime(), and ASN1TUTCTime::ASN1TUTCTime().
|
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.
utc | UTC flag state. |
Reimplemented in ASN1TUTCTime.
Referenced by ASN1TUTCTime::ASN1TUTCTime().
|
virtual |
This method sets the year component of the time value.
Note that the action of this method may differ for different inherited ASN1TTime classes.
year_ | Year component (full 4 digits). |
Reimplemented in ASN1TUTCTime.
Referenced by ASN1TUTCTime::ASN1TUTCTime().
EXTRTMETHOD const char* ASN1TTime::toString | ( | char * | pbuf, |
OSSIZE | bufsize | ||
) | const |
Get a printable ASCII string of the time value into the specified buffer.
pbuf | Pointer to a destination buffer. |
bufsize | Size of destination buffer. |
EXTRTMETHOD char* ASN1TTime::toString | ( | OSCTXT * | pctxt | ) | const |
Get a printable ASCII string of the time value. Memory for the returned string is allocated using the rtxMemAlloc function and is freed either when context memory is freed or explicitly via a call to rtxMemFreePtr.
pctxt | Pointer to a context structure. |
EXTRTMETHOD char* ASN1TTime::toString | ( | ) | const |
Get a printable ASCII string of the time value. Memory will be allocated using new[] operator. User is responsible to free it using delete[].
OSBOOL ASN1TTime::mbDerRules |
This member variable tells whether we will encode this time according to the Distinguished Encoding Rules (DER) or not.
OSBOOL ASN1TTime::mbUtcFlag |
This member variable tells whether this time is UTC time or not.
short ASN1TTime::mDay |
This member variable holds this time's day.
short ASN1TTime::mDiffHour |
This member variable holds this time's hour differential.
short ASN1TTime::mDiffMin |
This member variable holds this time's minute differential.
short ASN1TTime::mHour |
This member variable holds this time's hour.
short ASN1TTime::mMinute |
This member variable holds this time's minute.
short ASN1TTime::mMonth |
This member variable holds this time's month.
int ASN1TTime::mSecFracLen |
This member variable holds this time's fractional seconds length.
int ASN1TTime::mSecFraction |
This member variable holds this time's fractional seconds.
short ASN1TTime::mSecond |
This member variable holds this time's second.
int ASN1TTime::mStatus |
This member variable holds this time's status.
short ASN1TTime::mYear |
This member variable holds this time's year.