isc_encode_sql_time()

From InterBase

Go Up to API Function Reference


Translates a time from the C struct tm format to InterBase ISC_TIME format prior to inserting or updating a TIME value in a table.

Syntax

 void isc_encode_sql_time(
 void *tm_date,
 ISC_TIME *ib_time);
Parameter Type Description

tm_date

void *

Pointer to a C tm structure

ib_time

ISC_TIME *

Pointer to a four-byte ISC_TIME structure containing a time in InterBase format.

Description

isc_encode_sql_time() translates a date in a C time structure into an ISC_TIME format internal to InterBase. This call is used prior to writing TIME data to a table to guarantee that the time is in a format recognized by InterBase.

Use the isc_dsql family of API calls to insert or update TIME data from the ISC_TIME structure in a table.

Note: isc_encode_sql time() does not support milliseconds, because encode/decode functions use the structure struct tm from time.h, which does not support a fractional part for seconds.

Example

The following code fragment illustrates declaring time structures and calling isc_encode_sql_time() to translate a C time format into an InterBase date format prior to inserting or updating a table:

#include <time.h>
#include <ibase.h>
. . .
struct tm hire_time;
ISC_TIME hire_date;
. . .
/* Store time info into the tm struct here. */
. . .
isc_encode_sql_time(&hire_time, &hire_date);
/* Now use DSQL INSERT or UPDATE to move the date into a TIME column. */

Return value

None.

See Also

Advance To: