| 1 |  | 
|---|
| 2 | #include <boost/units/systems/si/io.hpp> | 
|---|
| 3 | #include <boost/units/systems/si/prefixes.hpp> | 
|---|
| 4 | #include <boost/units/base_units/metric/year.hpp> | 
|---|
| 5 |  | 
|---|
| 6 |  | 
|---|
| 7 | using namespace boost::units; | 
|---|
| 8 | using namespace boost::units::si; | 
|---|
| 9 |  | 
|---|
| 10 | using std::cout; | 
|---|
| 11 | using std::endl; | 
|---|
| 12 |  | 
|---|
| 13 |  | 
|---|
| 14 | int main() | 
|---|
| 15 | { | 
|---|
| 16 | typedef metric::year_base_unit::unit_type year_type; | 
|---|
| 17 | quantity<year_type> t1(7.90e16 * si::seconds); | 
|---|
| 18 | cout << "Using years: " << t1 << endl; | 
|---|
| 19 | typedef scaled_base_unit<metric::year_base_unit, scale<10, static_rational<9> > > gigayear_base_unit; | 
|---|
| 20 | typedef gigayear_base_unit::unit_type gyr_type; | 
|---|
| 21 | quantity<gyr_type> t2(7.90e16 * si::seconds); | 
|---|
| 22 | cout << "Using Gigayears: " << t2 << endl; | 
|---|
| 23 | return 0; | 
|---|
| 24 | } | 
|---|