How can I please Insert Binary Timestamp in the table car1 using libpq and PQexecParams? The code works but the timestamp in the table is not correct
res = PQexec(conn, "CREATE TABLE IF NOT EXISTS car1 (id int, price float8, sale float8, delay timestamp);");
const char command[] = "INSERT INTO car1 (id, price, sale, delay)"
"VALUES($1::integer, $2::float8, $3::float8, $4::timestamp)";
int nParams = 4;
const Oid paramTypes[] = {23, 701, 701, 1114};
const int paramLengths[] = {sizeof(int), sizeof(double), sizeof(double), sizeof(long long int)};
const int paramFormats[] = {1, 1, 1, 1};
int resultFormat = 0;
int test = htonl(45);
double test2;
double test3;
long long int test4 = htonl(1594817246);
to_nbo(75.585, &test2);
to_nbo(8.4785, &test3);
const char *const paramValues2[] = {(const char*)&test, (const char*)&test2, (const char*)&test3, (const char*)&test4};
/* PQexecParams INSERT */
res = PQexecParams(conn, command, nParams, paramTypes, paramValues2, paramLengths, paramFormats, resultFormat);
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
std::cout << "PQexecParams failed: " << PQresultErrorMessage(res)
<< std::endl;
}