Boost logo

Boost :

Subject: [boost] [locale] Strange(?) result in example code
From: Noah Roberts (roberts.noah_at_[hidden])
Date: 2011-04-15 15:33:16


#include <boost/locale.hpp>

#include <iostream>
//#include <ctime>

using namespace boost::locale;

int main()
{
   generator gen;
   //std::locale::global(gen("snthsnth")); // no exception
   std::locale::global(gen("en_US.UTF-8"));

   double now = time(0);

   std::cout << "Today is " << as::date << now << std::endl
             << "Current time is " << as::time << now << std::endl
             << "The current weekday is " << as::ftime("%A") << now <<
std::endl;

   std::cin.get();
}

http://cppcms.sourceforge.net/boost_locale/html/formatting_and_parsing.html

I get warnings about converting from time_t to double (which I rather
expected) and then get basic, double formatted output:

Today is 1.3029e+009
Current time is 1.3029e+009
The current weekday is 1.3029e+009


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk