Thread: [Cppcms-users] booster::locale::as::ftime(...) sometimes causes wrong result
Brought to you by:
artyom-beilis
|
From: Petr J. <ele...@ex...> - 2013-06-17 08:01:13
Attachments:
signature.asc
|
Hi,
I'm not sure what the problem is here.
example:
std::istringstream is("2010-10-01");
date_time dt;
is >> as::ftime("%Y-%m-%d") >> dt;
In this case dt is correctly set to the right date.
But if:
std::istringstream is("10-01-2010");
date_time dt;
is >> as::ftime("%d-%m-%Y") >> dt;
In this case dt is set to the wrong date, usually a year earlier.
cppcms was compiled with ICU. the stringstreams failbit is false in both
cases.
Any ideas?
--
Please use PGP to encrypt your email to ensure our privacy is respected.
|
|
From: <ele...@ex...> - 2013-06-17 09:47:43
|
Simple test:
#include <booster/locale.h>
#include <iostream>
#include <sstream>
using namespace booster::locale;
using namespace std;
int main()
{
generator gen;
std::locale::global(gen(""));
std::cout.imbue(std::locale());
string str1="2010-08-10";
string str2="10-08-2010";
istringstream is(str1);
date_time dt;
is >> as::ftime("%Y-%m-%d") >> dt;
cout << as::date << dt << endl;
istringstream is2(str2);
date_time dt2;
is2 >> as::ftime("%d-%m-%Y") >> dt2;
cout << as::date << dt2 << endl;
}
Prints:
[petr@petr-archlinux ~]$ ./a.out
10/08/2010
20/12/2009
|
|
From: Artyom B. <art...@ya...> - 2013-06-24 19:17:59
|
Hi, can you please open a ticket. I'll look into it? Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ ----- Original Message ----- > From: "ele...@ex..." <ele...@ex...> > To: cpp...@li... > Cc: > Sent: Monday, June 17, 2013 12:47 PM > Subject: Re: [Cppcms-users] booster::locale::as::ftime(...) sometimes causes wrong result > > Simple test: > > #include <booster/locale.h> > #include <iostream> > #include <sstream> > > using namespace booster::locale; > using namespace std; > > int main() > { > generator gen; > std::locale::global(gen("")); > std::cout.imbue(std::locale()); > > string str1="2010-08-10"; > string str2="10-08-2010"; > > istringstream is(str1); > date_time dt; > > is >> as::ftime("%Y-%m-%d") >> dt; > cout << as::date << dt << endl; > > istringstream is2(str2); > date_time dt2; > > is2 >> as::ftime("%d-%m-%Y") >> dt2; > cout << as::date << dt2 << endl; > } > > Prints: > > [petr@petr-archlinux ~]$ ./a.out > 10/08/2010 > 20/12/2009 > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
|
From: Shiv S. D. <shi...@gm...> - 2013-06-24 19:19:37
|
Sure. I will search that email or try to build myself 1.0.4 and then open a ticket. On Tue, Jun 25, 2013 at 12:47 AM, Artyom Beilis <art...@ya...> wrote: > Hi, can you please open a ticket. I'll look into it? > > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > > > ----- Original Message ----- > > From: "ele...@ex..." <ele...@ex...> > > To: cpp...@li... > > Cc: > > Sent: Monday, June 17, 2013 12:47 PM > > Subject: Re: [Cppcms-users] booster::locale::as::ftime(...) sometimes > causes > wrong result > > > > Simple test: > > > > #include <booster/locale.h> > > #include <iostream> > > #include <sstream> > > > > using namespace booster::locale; > > using namespace std; > > > > int main() > > { > > generator gen; > > std::locale::global(gen("")); > > std::cout.imbue(std::locale()); > > > > string str1="2010-08-10"; > > string str2="10-08-2010"; > > > > istringstream is(str1); > > date_time dt; > > > > is >> as::ftime("%Y-%m-%d") >> dt; > > cout << as::date << dt << endl; > > > > istringstream is2(str2); > > date_time dt2; > > > > is2 >> as::ftime("%d-%m-%Y") >> dt2; > > cout << as::date << dt2 << endl; > > } > > > > Prints: > > > > [petr@petr-archlinux ~]$ ./a.out > > 10/08/2010 > > 20/12/2009 > > > > > > > ------------------------------------------------------------------------------ > > This SF.net email is sponsored by Windows: > > > > Build for Windows Store. > > > > http://p.sf.net/sfu/windows-dev2dev > > _______________________________________________ > > Cppcms-users mailing list > > Cpp...@li... > > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > -- Best regards, Shiv Shankar Dayal |
|
From: Petr J. <ele...@ex...> - 2013-06-25 01:18:02
Attachments:
signature.asc
|
Done. https://sourceforge.net/p/cppcms/bugs/98/ Also please note that this bug report and the attached patch https://sourceforge.net/p/cppcms/bugs/97/ Accidentally posted it as anonymous. On 25/06/2013 5:17 AM, Artyom Beilis wrote: > Hi, can you please open a ticket. I'll look into it? > > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > > > ----- Original Message ----- >> From: "ele...@ex..." <ele...@ex...> >> To: cpp...@li... >> Cc: >> Sent: Monday, June 17, 2013 12:47 PM >> Subject: Re: [Cppcms-users] booster::locale::as::ftime(...) sometimes causes > wrong result >> >> Simple test: >> >> #include <booster/locale.h> >> #include <iostream> >> #include <sstream> >> >> using namespace booster::locale; >> using namespace std; >> >> int main() >> { >> generator gen; >> std::locale::global(gen("")); >> std::cout.imbue(std::locale()); >> >> string str1="2010-08-10"; >> string str2="10-08-2010"; >> >> istringstream is(str1); >> date_time dt; >> >> is >> as::ftime("%Y-%m-%d") >> dt; >> cout << as::date << dt << endl; >> >> istringstream is2(str2); >> date_time dt2; >> >> is2 >> as::ftime("%d-%m-%Y") >> dt2; >> cout << as::date << dt2 << endl; >> } >> >> Prints: >> >> [petr@petr-archlinux ~]$ ./a.out >> 10/08/2010 >> 20/12/2009 >> >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by Windows: >> >> Build for Windows Store. >> >> http://p.sf.net/sfu/windows-dev2dev >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > -- Please use PGP to encrypt your email to ensure our privacy is respected. |