Skip to content

Commit

Permalink
fix sqlite conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Jul 28, 2023
1 parent 4c64214 commit 84b500f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions c/driver/sqlite/statement_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ AdbcStatusCode AdbcSqliteBinderSetArrayStream(struct AdbcSqliteBinder* binder,
return AdbcSqliteBinderSet(binder, error);
}

#define MILLISECONDS_PER_DAY 86400000;
#define SECONDS_PER_DAY 86400;

/*
Allocates to buf on success. Caller is responsible for freeing.
Expand All @@ -104,15 +104,15 @@ static AdbcStatusCode ArrowDate32ToIsoString(int32_t value, char** buf,
int strlen = 10;

#if SIZEOF_TIME_T < 8
if ((seconds > INT32_MAX / MILLISECONDS_PER_DAY) ||
(seconds < INT32_MIN / MILLISECONDS_PER_DAY)) {
if ((seconds > INT32_MAX / SECONDS_PER_DAY) ||
(seconds < INT32_MIN / SECONDS_PER_DAY)) {
SetError(error, "Date %" PRId32 " exceeds platform time_t bounds", value);

return ADBC_STATUS_INVALID_ARGUMENT;
}
const time_t time = (time_t)(value * MILLISECONDS_PER_DAY);
const time_t time = (time_t)(value * SECONDS_PER_DAY);
#else
const time_t time = value * MILLISECONDS_PER_DAY;
const time_t time = value * SECONDS_PER_DAY;
#endif

struct tm broken_down_time;
Expand Down

0 comments on commit 84b500f

Please sign in to comment.