perf_format.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See
  5. // accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. //
  8. #include <iostream>
  9. #include <string>
  10. #include <set>
  11. #include <ctime>
  12. #include <boost/locale.hpp>
  13. using namespace std;
  14. using namespace boost::locale;
  15. int main(int argc,char **argv)
  16. {
  17. if(argc!=2) {
  18. std::cerr << "Usage backend locale" << std::endl;
  19. return 1;
  20. }
  21. boost::locale::localization_backend_manager mgr = boost::locale::localization_backend_manager::global();
  22. mgr.select(argv[1]);
  23. generator gen(mgr);
  24. std::locale::global(gen(argv[2]));
  25. /// Set global locale to requested
  26. for(int i=0;i<100000;i++) {
  27. std::ostringstream ss;
  28. for(int j=0;j<5;j++) {
  29. ss << boost::locale::as::datetime << std::time(0) <<" "<< boost::locale::as::number << 13456.345 <<"\n";
  30. }
  31. if(i==0)
  32. std::cout << ss.str() << std::endl;
  33. }
  34. }
  35. // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4