Class template time_date_t
boost::asn1::time_date_t — ASN1 time template.
Synopsis
Description
Time-Date
The time and date functionality for ASN1 are supported in Boost.ASN1 through the template class time_date_t. This template has two specializations to for the ASN1 time data types.
The time_date_t stores it's internal data in a private struct that contains all the relevant pieces of data for time and date management. Access to this data is through member functions for getting/setting pieces of a time-date object.
The main difference between the two times of representations is the amount of data transmitted in their respective values. Generalized times use a full year value as YYYY, where as UTC times only use the last two digits, YY. The time-date template accepts Y2K and non-Y2K years. It will automatically deduce a non-Y2K number and make it Y2K complient.
Assignment between the two time-date types is allowed.
Usage
utctime_t utcTime;
utcTime.setYMD(8,2,1);
utcTime.setHMS(13,12,10);
cout << to_simple_string(utcTime) << endl;
generalizedtime_t generalTime(utcTime);
cout << to_simple_string(generalTime) << endl;
time_date_t construct/copy/destruct
time_date_t();
-
time_date_t(const asn_base_ptr & ptr);
Copies an time_date_t being pass by an asn_base_ptr.
|
Parameters: |
ptr |
asn_base_ptr to copy from |
|
-
time_date_t(const time_date_t & tt);
Copies an time_date_t object
|
Parameters: |
tt |
A time_date_t object whose content is entirely copied. |
|
-
time_date_t(const ptime & pt);
Sets the content from a ptime object
|
Parameters: |
pt |
A ptime object whose content is entirely copied. |
|
time_date_t& operator=(const time_date_t & tt);
time_date_t& operator=(const ptime & pt);
~time_date_t();
time_date_t public member functions
-
void assign(const time_date_t & tt) ;
|
Parameters: |
tt |
A time_date_t object whose content is entirely copied. |
|
-
void assign(const ptime & pt) ;
|
Parameters: |
pt |
A ptime object whose content is entirely copied. |
|
-
void assign(const asn_base_t * asn_object) ;
|
Parameters: |
asn_object |
Value to assign |
|
const ptime operator()() ;
operator ptime() ;
int getYear() const;
int getMonth() const;
int getDay() const;
int getHour() const;
int getMinute() const;
int getSecond() const;
int getFraction() const;
int getOffset() const;
-
void setYMD(const int y, const int m, const int d) ;
|
Parameters: |
d |
Day to set |
m |
Month to set |
y |
Year to set |
|
-
void setHMS(const int h, const int m, const int s, const int f = 0) ;
|
Parameters: |
f |
Fraction of a second to set |
h |
Hour to set |
m |
Minute to set |
s |
Second to set |
|
-
void setYear(const int y) ;
Accepts non-Y2k and Y2k values.
-
void setMonth(const int m) ;
-
void setDay(const int d) ;
-
void setHour(const int h) ;
-
void setMinute(const int m) ;
-
void setSecond(const int s) ;
-
void setFraction(const int f) ;
|
Parameters: |
f |
Fractions of a second to set |
|
-
void setOffset(const int o) ;
|
Parameters: |
o |
Time zone Offset to set |
|
asn_base_ptr clone() const;
-
uint32_t encode(asn_visitor_t & visitor) ;
Calls the time_date_t type's policy to encode the data for the time_date_t.
|
Parameters: |
visitor |
asn_visitor_t used for the encoding. |
|
|
Returns: |
The number of bytes used to encode the time_date_t's data |
-
uint32_t decode(asn_visitor_t & visitor) ;
Calls the integral type's policy to decode the data for the time_date_t.
|
Parameters: |
visitor |
asn_visitor_t used for the decoding. |
|
|
Returns: |
The number of bytes used to decode the time_date_t's data |
-
const uint32_t length() ;
If ASN1 objects have been added since the time this function was called, it will recalculate the length
-
size_t size_of() ;
Gets the size of the ASN1 object
Returns the size of the ASN1 class object sizeof(ASN1)
time_date_t public static functions
static asn_base_ptr create() ;
time_date_t protected member functions