Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isc_encode_timestamp with support millisecond (and isc_decode_timestamp) [CORE3036] #3417

Open
firebird-automations opened this issue Jun 10, 2010 · 9 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Oleg Matveyev (o_matveev)

Votes: 1

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*);

@firebird-automations
Copy link
Collaborator Author

Modified by: Oleg Matveyev (o_matveev)

description: Please, create the new api function 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*);

=>

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*);

@firebird-automations
Copy link
Collaborator Author

Modified by: Oleg Matveyev (o_matveev)

Component: API / Client Library [ 10040 ]

Version: 2.5 RC2 [ 10372 ] =>

Version: 2.5 RC1 [ 10362 ] =>

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

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.

@firebird-automations
Copy link
Collaborator Author

Modified by: Sean Leyne (seanleyne)

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Duplicate [ 3 ]

Fix Version: 2.0.5 [ 10222 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

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

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

status: Resolved [ 5 ] => Reopened [ 4 ]

resolution: Duplicate [ 3 ] =>

Fix Version: 2.0.5 [ 10222 ] =>

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Issue is present in all released up to today versions of Firebird

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

Version: 2.5 RC2 [ 10372 ]

Version: 2.5 RC1 [ 10362 ]

Version: 3.0 Initial [ 10301 ]

Version: 1.5.6 [ 10225 ]

Version: 2.1.3 [ 10302 ]

Version: 2.5 Beta 2 [ 10300 ]

Version: 2.5 Beta 1 [ 10251 ]

Version: 2.1.2 [ 10270 ]

Version: 2.0.5 [ 10222 ]

Version: 2.1.1 [ 10223 ]

Version: 2.5 Alpha 1 [ 10224 ]

Version: 2.0.4 [ 10211 ]

Version: 2.1.0 [ 10041 ]

Version: 1.5.5 [ 10220 ]

Version: 2.0.3 [ 10200 ]

Version: 2.0.2 [ 10130 ]

Version: 2.0.1 [ 10090 ]

Version: 1.5.4 [ 10100 ]

Version: 2.0.0 [ 10091 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Oleg Matveyev (o_matveev)

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment