Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Time-Date

The time and date functionality is supported through the template class time_date_t. This template has two specializations to for the ASN1 time types.

ASN1 Type C++ Equiv
UTC TIME utctime_t
GENERALIZED TIME generalizedtime_t

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 types 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.

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;

Copyright © 2007 Andreas Haberstroh

PrevUpHomeNext