Ejemplo n.º 1
0
TEST(TimeHelpersTest, TimestampToMicrosecondsForYear4000)
{
    SQL_TIMESTAMP_STRUCT data = {4000, 01, 02, 3, 4, 5, 123456000};
    // expectation generated by unixtimestamp.com
    std::int64_t expected = 64060686245 * 1000000 + 123456;
    EXPECT_EQ(expected, timestamp_to_microseconds(reinterpret_cast<char const *>(&data)));
}
Ejemplo n.º 2
0
TEST(TimeHelpersTest, TimestampToMicrosecondsForEpoch)
{
    SQL_TIMESTAMP_STRUCT data = {1970, 01, 01, 0, 0, 0, 0};
    EXPECT_EQ(0, timestamp_to_microseconds(reinterpret_cast<char const *>(&data)));
}