[Cppcms-users] booster::locale::date_time to timestamp conversion issues / basis for booster::local
Brought to you by:
artyom-beilis
|
From: Alexander M. <a....@ev...> - 2015-11-26 13:43:44
|
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
|