8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 06:03:02 +01:00

Fixed CORE-1962 - Incorrect extraction of MILLISECONDs

This commit is contained in:
asfernandes 2008-06-25 15:58:03 +00:00
parent e903d56de0
commit cf7af2292d
2 changed files with 11 additions and 10 deletions

View File

@ -1319,7 +1319,7 @@ void MAKE_desc(CompiledStatement* statement, dsc* desc, dsql_nod* node, dsql_nod
break; break;
case blr_extract_millisecond: case blr_extract_millisecond:
desc->makeLong(0); desc->makeLong(ISC_TIME_SECONDS_PRECISION_SCALE + 3);
break; break;
default: default:

View File

@ -3514,20 +3514,21 @@ static dsc* extract(thread_db* tdbb, jrd_nod* node, impure_value* impure)
case blr_extract_minute: case blr_extract_minute:
part = times.tm_min; part = times.tm_min;
break; break;
case blr_extract_second: 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; 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: case blr_extract_millisecond:
impure->vlu_desc.dsc_dtype = dtype_long; 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); impure->vlu_desc.dsc_length = sizeof(ULONG);
*(ULONG *) impure->vlu_desc.dsc_address = impure->vlu_desc.dsc_scale = ISC_TIME_SECONDS_PRECISION_SCALE + 3;
times.tm_sec * ISC_TIME_SECONDS_PRECISION + fractions; impure->vlu_desc.dsc_address = reinterpret_cast<UCHAR*>(&impure->vlu_misc.vlu_long);
(*(ULONG *) impure->vlu_desc.dsc_address) = fractions;
if (extract_part == blr_extract_millisecond)
(*(ULONG *) impure->vlu_desc.dsc_address) /= ISC_TIME_SECONDS_PRECISION / 1000;
return &impure->vlu_desc; return &impure->vlu_desc;
case blr_extract_week: case blr_extract_week: