Issue Details (XML | Word | Printable)

Key: CORE-3036
Type: Improvement Improvement
Status: Reopened Reopened
Priority: Trivial Trivial
Assignee: Unassigned
Reporter: Oleg Matveyev
Votes: 1
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Firebird Core

isc_encode_timestamp with support millisecond (and isc_decode_timestamp)

Created: 10/Jun/10 12:29 PM   Updated: 10/Jun/10 07:31 PM
Component/s: API / Client Library
Affects Version/s: 2.0.0, 1.5.4, 2.0.1, 2.0.2, 2.0.3, 1.5.5, 2.1.0, 2.0.4, 2.5 Alpha 1, 2.1.1, 2.0.5, 2.1.2, 2.5 Beta 1, 2.5 Beta 2, 2.1.3, 1.5.6, 3.0 Initial, 2.5 RC1, 2.5 RC2
Fix Version/s: None


 Description  « Hide
Please, make the new api functions with support millisecond:

void ISC_EXPORT fb_encode_timestamp(const void*, int millisecond, ISC_TIMESTAMP*);

void ISC_EXPORT fb_decode_timestamp(const ISC_TIMESTAMP*, int &millisecond, void*);

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Sean Leyne added a comment - 10/Jun/10 06:45 PM
The accuracy of the Timestamp can already be increased using the syntax:

- SELECT CURRENT_TIME FROM RDB$DATABASE;
- SELECT CURRENT_TIME(3) FROM RDB$DATABASE;
- SELECT CURRENT_TIMESTAMP(3) FROM RDB$DATABASE;

This change was made during the v2.0.x development process, please see the release notes for details.

Vlad Khorsun added a comment - 10/Jun/10 07:26 PM
Sean, it is about how to work with milliseconds at client side, using API.
Current API can nor extract milliseconds from ISC_TIME nor put time with milliseconds into ISC_TIME

Vlad Khorsun added a comment - 10/Jun/10 07:27 PM
Issue is present in all released up to today versions of Firebird

Oleg Matveyev added a comment - 10/Jun/10 07:31 PM
I do not need write the current time. I need to write to the database exact time, including millisecond, obtained from an external source.
Now I am forced to use non-obvious code:

struct tm *ptm_Value = ... // Datetime from external source
int millisecond = ... // millisecond part of Datetime

XSQLVAR *var = ... // struct for Query Pararameter

if(ptm_Value == NULL)
{
  *(var -> sqlind) = -1;
} else
{
  *(var -> sqlind) = 0;

  ISC_TIMESTAMP* data = (ISC_TIMESTAMP*)(var -> sqldata);

  isc_encode_timestamp(ptm_Value, data);
  data->timestamp_time += millisecond * 10; // WTF?
}


Btw, how about read a millisecond from the database?
What is the API-function is designed to extract the hour / minutes / seconds and milliseconds part of ISC_TIMESTAMP?