I'm using:
It calculates hours as a negative value. For example, this time
auto time = boost::posix_time::from_iso_string("20230613T130922");
is shown as:
2023-6-13 -6-8:01:44 0ms 0us
The hour variable gets -68. The source of miscalculation is this division:
<Intrinsic Name="hour" Expression="_t_hours()/3600000000"/>
Debugger seems to be treating the literal as uint32 and extends it to int64 this way:
auto hour = t_hours/static_cast<int>(3600000000);
I.e. it first converts it to int32, making it negative, and then extends the negative value to 64 bits.
This change fixes this:
<Intrinsic Name="hour" Expression="_t_hours()/3600000000LL"/>
<Intrinsic Name="_t_minutes" Expression="_t_hours()-3600000000LL*hour()"/>
(Note, boost::local_time::posix_time_zone_base also uses the constant).
This is probably a debugger bug, because it must be following C++ expression rules, and this calculations written in C++ give the right value. But I'm not sure.
auto time = boost::posix_time::from_iso_string("20230613T130922"); // To check it in "Locals" window
__int64 value = 212553464962000000ll;
auto x = value/86400000000;
auto t_hours = value-86400000000*x;
auto hour = t_hours/3600000000;
hour is 13.
I'm using:
It calculates hours as a negative value. For example, this time
is shown as:
The
hourvariable gets-68. The source of miscalculation is this division:Debugger seems to be treating the literal as uint32 and extends it to
int64this way:I.e. it first converts it to int32, making it negative, and then extends the negative value to 64 bits.
This change fixes this:
(Note,
boost::local_time::posix_time_zone_basealso uses the constant).This is probably a debugger bug, because it must be following C++ expression rules, and this calculations written in C++ give the right value. But I'm not sure.
houris13.