mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 22:43:04 +01:00
Fixed CORE-1962 - Incorrect extraction of MILLISECONDs
This commit is contained in:
parent
e903d56de0
commit
cf7af2292d
@ -1319,7 +1319,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
|
||||
break;
|
||||
|
||||
case blr_extract_millisecond:
|
||||
desc->makeLong(0);
|
||||
desc->makeLong(ISC_TIME_SECONDS_PRECISION_SCALE + 3);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -3514,20 +3514,21 @@ static dsc* extract(thread_db* tdbb, jrd_nod* node, impure_value* impure)
|
||||
case blr_extract_minute:
|
||||
part = times.tm_min;
|
||||
break;
|
||||
|
||||
case blr_extract_second:
|
||||
impure->vlu_desc.dsc_dtype = dtype_long;
|
||||
impure->vlu_desc.dsc_length = sizeof(ULONG);
|
||||
impure->vlu_desc.dsc_scale = ISC_TIME_SECONDS_PRECISION_SCALE;
|
||||
// fall through
|
||||
impure->vlu_desc.dsc_address = reinterpret_cast<UCHAR*>(&impure->vlu_misc.vlu_long);
|
||||
*(ULONG *) impure->vlu_desc.dsc_address = times.tm_sec * ISC_TIME_SECONDS_PRECISION + fractions;
|
||||
return &impure->vlu_desc;
|
||||
|
||||
case blr_extract_millisecond:
|
||||
impure->vlu_desc.dsc_dtype = dtype_long;
|
||||
impure->vlu_desc.dsc_address =
|
||||
reinterpret_cast<UCHAR*>(&impure->vlu_misc.vlu_long);
|
||||
impure->vlu_desc.dsc_length = sizeof(ULONG);
|
||||
*(ULONG *) impure->vlu_desc.dsc_address =
|
||||
times.tm_sec * ISC_TIME_SECONDS_PRECISION + fractions;
|
||||
|
||||
if (extract_part == blr_extract_millisecond)
|
||||
(*(ULONG *) impure->vlu_desc.dsc_address) /= ISC_TIME_SECONDS_PRECISION / 1000;
|
||||
|
||||
impure->vlu_desc.dsc_scale = ISC_TIME_SECONDS_PRECISION_SCALE + 3;
|
||||
impure->vlu_desc.dsc_address = reinterpret_cast<UCHAR*>(&impure->vlu_misc.vlu_long);
|
||||
(*(ULONG *) impure->vlu_desc.dsc_address) = fractions;
|
||||
return &impure->vlu_desc;
|
||||
|
||||
case blr_extract_week:
|
||||
|
Loading…
Reference in New Issue
Block a user