Skip to content

Invalid range of supported datetime values in test #191

Closed
@tsafin

Description

@tsafin

In the tarantool/tarantool#6725 we are adding validity check for incoming datetime values, and unfortunately it breaks go-tarantool regression test as it was trying to insert invalid (epoch overflow) value in their test:

https://github.com/tarantool/go-tarantool/blob/master/datetime/datetime_test.go#L20

var (
	minTime = time.Unix(0, 0)
	maxTime = time.Unix(1<<63-1, 999999999)
)

maxTime is too big, as we limited with different boundaries (due to c-dt usage).

/**
 * c-dt library uses int as type for dt value, which
 * represents the number of days since Rata Die date.
 * This implies limits to the number of seconds we
 * could safely store in our structures and then safely
 * pass to c-dt functions.
 *
 * So supported ranges will be
 * - for seconds [-185604722870400 .. 185480451417600]
 * - for dates   [-5879610-06-22T00:00Z .. 5879611-07-11T00:00Z]
 */
#define MAX_DT_DAY_VALUE (int64_t)INT_MAX
#define MIN_DT_DAY_VALUE (int64_t)INT_MIN
#define SECS_EPOCH_1970_OFFSET 	((int64_t)DT_EPOCH_1970_OFFSET * SECS_PER_DAY)
#define MAX_EPOCH_SECS_VALUE    \
	(MAX_DT_DAY_VALUE * SECS_PER_DAY - SECS_EPOCH_1970_OFFSET)
#define MIN_EPOCH_SECS_VALUE    \
	(MIN_DT_DAY_VALUE * SECS_PER_DAY - SECS_EPOCH_1970_OFFSET)

Please correct the value used as it's blocking tarantool commit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions