date_time/test/testint64_range.cpp
Daniel James c9f634b1d4 Merged revisions 43211,43214-43219,43222-43225,43227-43238,43242,43244-43245,43249-43250,43257-43259,43261,43263,43265,43267-43268,43270-43271,43273,43275-43279,43284-43289,43291,43295,43297-43298,43304-43305,43307,43313,43315,43324,43326-43327,43331,43333,43339-43343,43345,43348,43350,43352-43353,43355-43356,43358,43360,43366-43367,43369-43370,43372-43376,43378-43389,43394,43396-43398,43400-43401,43403-43404,43406-43408,43413-43415,43417-43418,43420,43422-43423 via svnmerge from
https://svn.boost.org/svn/boost/trunk

........
  r43417 | danieljames | 2008-02-26 22:04:55 +0000 (Tue, 26 Feb 2008) | 2 lines
  
  Fix a link to Boost.Bimap.
........
  r43418 | danieljames | 2008-02-26 22:07:25 +0000 (Tue, 26 Feb 2008) | 2 lines
  
  Change another link that's no longer in the repository to link to the website.
........
  r43422 | danieljames | 2008-02-27 18:51:14 +0000 (Wed, 27 Feb 2008) | 1 line
  
  Fix broken copyright urls. Fixes #1573.
........
  r43423 | danieljames | 2008-02-27 19:22:01 +0000 (Wed, 27 Feb 2008) | 1 line
  
  Fix incorrect links to copyright of the form 'http:#www.boost.org
........


[SVN r43425]
2008-02-27 20:00:24 +00:00

96 lines
2.9 KiB
C++

/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland
*/
//#include "date_time/testfrmwk.hpp"
#include <iostream>
#include "boost/date_time/gregorian/gregorian.hpp"
#include "boost/cstdint.hpp"
int
main()
{
#if (defined(BOOST_MSVC) && (_MSC_VER < 1300))
//skipping tests here due to lack of operator<< support in msvc6
// TODO: this is a bit misleading: using STLport, this should work.
std::cout << "Skipping tests on MSVC6" << std::endl;
#else
std::cout << "int64_t max: "
<< (std::numeric_limits<boost::int64_t>::max)()
<< std::endl;
std::cout << "uint64_t max: "
<< (std::numeric_limits<boost::uint64_t>::max)()
<< std::endl;
boost::int64_t seconds_per_day = 60*60*24;
boost::int64_t microsec_per_sec = 1000000;
boost::int64_t microsec_per_day = seconds_per_day*microsec_per_sec;
std::cout << "microsec per day: "
<< microsec_per_day
<< std::endl;
boost::uint64_t total_days = (std::numeric_limits<boost::int64_t>::max)() / microsec_per_day;
std::cout << "Representable days: "
<< total_days
<< std::endl;
boost::int64_t approx_years = total_days / 366;
std::cout << "Approximate years: "
<< approx_years
<< std::endl;
//getting day count
// usec_count / (seconds_per_day*usec_per_sec);
boost::int64_t day_count = 1000;
boost::int64_t usec_count1000 = day_count*microsec_per_day + 999999;
std::cout << "usec count at day 1000 + 999999: "
<< usec_count1000
<< std::endl;
boost::int64_t day_count_calc = usec_count1000 / microsec_per_day;
std::cout << "calc day count at day 1000: "
<< day_count_calc
<< std::endl;
boost::int64_t remaining_usec_count = usec_count1000 % microsec_per_day;
std::cout << "remaining usec count: "
<< remaining_usec_count
<< std::endl;
boost::int32_t day_count3M = 3000000;
boost::int64_t usec_count3M = day_count3M*microsec_per_day + 999999;
std::cout << "usec count at day 3M + 999999: "
<< usec_count3M
<< std::endl;
boost::int64_t day_count_calc3M = usec_count3M / microsec_per_day;
std::cout << "calc day count at day 3M: "
<< day_count_calc3M
<< std::endl;
boost::int64_t remaining_usec_count3M = usec_count3M % microsec_per_day;
std::cout << "remaining usec count 3M: "
<< remaining_usec_count3M
<< std::endl;
#endif
// std::cout << "Days from: "
// << to_simple_string(d1) << " to "
// << to_simple_string(d2) << " = "
// << day_count << std::endl;
// printTestStats();
return 0;
};