Re: [Cppcms-users] booster::locale::date_time to timestamp conversion issues / basis for booster::l
Brought to you by:
artyom-beilis
From: Alexander M. <a....@ev...> - 2015-11-30 13:54:34
|
Hi, I wasn't able to find the exact problem. The (brute force) solution was, just reinstalling the complete vmachine. Now it works fine. :-) Thank you for your help. Alex Am 26.11.2015 um 16:29 schrieb Alexander Mack: > Hi Artyom, > > Thank you for the promt answer. For building CppCMS I used the > description on http://cppcms.com/wikipp/en/page/cppcms_1x_build. I did > not make any special configurations regarding the ICU. > The CppCMS version is the same (Revision: 2329). > > Is it possible, that the Ubuntu version (and with that difference ICU > versions) can influence the results? > > The "working" maschine is Ubuntu 14.04.3 LTS with the following ICU > Version: > <icuSystemParams type="icu4c"> > <param name="copyright"> Copyright (C) 2013, International > Business Machines Corporation and others. All Rights Reserved. </param> > <param name="product">icu4c</param> > <param name="product.full">International Components for Unicode > for C/C++</param> > <param name="version">52.1</param> > <param name="version.unicode">6.3</param> > <param name="platform.number">4000</param> > <param name="platform.type">Linux</param> > <param name="locale.default">de_DE</param> > <param name="locale.default.bcp47">de-DE</param> > <param name="converter.default">UTF-8</param> > <param name="icudata.name">icudt52l</param> > <param name="icudata.path"></param> > <param name="cldr.version">24.0</param> > <param name="tz.version">2013g</param> > <param name="tz.default">Europe/Berlin</param> > <param name="cpu.bits">64</param> > <param name="cpu.big_endian">0</param> > <param name="os.wchar_width">4</param> > <param name="os.charset_family">0</param> > <param name="os.host">x86_64-pc-linux-gnu</param> > <param name="build.build">x86_64-pc-linux-gnu</param> > <param name="build.cc">gcc</param> > <param name="build.cxx">g++</param> > <param name="uconfig.internal_digitlist">1</param> > <param name="uconfig.have_parseallinput">1</param> > <param name="uconfig.format_fastpaths_49">1</param> > </icuSystemParams> > > > ICU Initialization returned: U_ZERO_ERROR > > > > The "not working" machine is Ubuntu 13.10 with the following ICU infos: > > <ICUINFO> > International Components for Unicode for C/C++ > Copyright (C) 2011, International Business Machines Corporation and > others. All Rights Reserved. > Compiled-Version: 4.8.1.1 > Runtime-Version: 4.8.1.1 > Compiled-Unicode-Version: 6.0 > Runtime-Unicode-Version: 6.0 > Platform: U_LINUX > Build: x86_64-pc-linux-gnu > C compiler: gcc > C++ compiler: g++ > ICUDATA: icudt48l > Data Directory: > ICU Initialization returned: U_ZERO_ERROR > Default locale: de_DE > CLDR-Version: 2.0.1 > Default converter: UTF-8 > Default TZ: Europe/Berlin > TZ data version: 2011k > Plugin file is: /usr/lib/x86_64-linux-gnu/icu/icuplugins48.txt > </ICUINFO> > > > I did no further calculations on the date_time objects. The following > source code is the whole date_time example I was trying out. The > complete test project is a little bit larger.. But I could try to > create a small test program and check the behaviour. > > // get some time some month ago.. > booster::locale::date_time dtCurrentTime; > booster::locale::date_time dtSomeMonthAgo = dtCurrentTime - > (booster::locale::period::month()); > > // get date_time for 1970-01-01 00:00:00 > booster::locale::date_time dtStart(0); > > // get timestamp > int iDifference = dtStart.difference(dtCurrent, > booster::locale::period::second()); > > BOOSTER_DEBUG("test") << "Timestamp of dtSomeMonthAgo: " << iDifference; > > Thank you very much for your help, > > Alex > > > > > > > Am 26.11.2015 um 15:37 schrieb Artyom Beilis: >> Is CppCMS compiled with ICU on both machines? >> Is it same CppCMS version? >> Also can you print all intermediate calculations as well? (i.e. >> dtCurrentTime,dtSomeMonthAgo and dtStart) >> In general second difference should be trivial i.e. mostly calculate >> difference between internal timestamp. >> >> Artyom >> >> ------------------------------------------------------------------------ >> *From:* Alexander Mack <a....@ev...> >> *To:* cpp...@li... >> *Sent:* Thursday, November 26, 2015 3:30 PM >> *Subject:* [Cppcms-users] booster::locale::date_time to timestamp >> conversion issues / basis for booster::locale::date_time >> >> Hello, >> >> I'm trying to convert a date_time object into a simple timestamp >> e.g.: >> >> // init environment... >> std::locale::global(booster::locale::generator().generate("")); >> cppcms::service srv(argc, argv); >> >> // .... >> >> // get some time some month ago.. >> booster::locale::date_time dtCurrentTime; >> booster::locale::date_time dtSomeMonthAgo = dtCurrentTime - >> (booster::locale::period::month()); >> >> // get date_time for 1970-01-01 00:00:00 >> booster::locale::date_time dtStart(0); >> >> // get timestamp >> int iDifference = dtStart.difference(dtCurrent, >> booster::locale::period::second()); >> >> That code works fine on Machine A.. But when I'm running the >> program on >> Machine B I get weird results.. >> On Machine A the timestamp for Mon, 26 Oct 2015 12:37:12 GMT is >> 1445863032. (correct) >> On Machine B the timestamp for Mon, 26 Oct 2015 12:37:12 GMT is >> 536870912. (wrong) >> >> The times on the machines are equal too.. timedatectl: >> >> Machine A: >> Local time: Do 2015-11-26 14:25:12 CET >> Universal time: Do 2015-11-26 13:25:12 UTC >> Timezone: Europe/Berlin (CET, +0100) >> NTP enabled: yes >> NTP synchronized: yes >> RTC in local TZ: no >> DST active: no >> Last DST change: DST ended at >> So 2015-10-25 02:59:59 CEST >> So 2015-10-25 02:00:00 CET >> Next DST change: DST begins (the clock jumps one hour forward) at >> So 2016-03-27 01:59:59 CET >> So 2016-03-27 03:00:00 CEST >> >> Machine B: >> Local time: Do 2015-11-26 14:25:38 CET >> Universal time: Do 2015-11-26 13:25:38 UTC >> RTC time: Do 2015-11-26 13:25:38 >> Timezone: Europe/Berlin (CET, +0100) >> NTP enabled: yes >> NTP synchronized: no >> RTC in local TZ: no >> DST active: no >> Last DST change: DST ended at >> So 2015-10-25 02:59:59 CEST >> So 2015-10-25 02:00:00 CET >> Next DST change: DST begins (the clock jumps one hour forward) at >> So 2016-03-27 01:59:59 CET >> So 2016-03-27 03:00:00 CEST >> >> >> Maybe someone had the same issue and knows what the problem is? >> >> I would appreciate any tip :-) >> >> Thank you very much, >> >> Alex >> >> >> >> ------------------------------------------------------------------------------ >> Go from Idea to Many App Stores Faster with Intel(R) XDK >> Give your users amazing mobile app experiences with Intel(R) XDK. >> Use one codebase in this all-in-one HTML5 development environment. >> Design, debug & build mobile apps & 2D/3D high-impact games for >> multiple OSs. >> http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140 >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> <mailto:Cpp...@li...> >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> >> >> >> ------------------------------------------------------------------------------ >> Go from Idea to Many App Stores Faster with Intel(R) XDK >> Give your users amazing mobile app experiences with Intel(R) XDK. >> Use one codebase in this all-in-one HTML5 development environment. >> Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. >> http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140 >> >> >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users > |