Пример #1
0
TEST(TimeHelpersTest, DaysToDateForEpoch)
{
    std::int64_t const days = 0;
    SQL_TIMESTAMP_STRUCT ts;
    days_to_date(days, reinterpret_cast<char *>(&ts));
    EXPECT_EQ(1970, ts.year);
    EXPECT_EQ(1, ts.month);
    EXPECT_EQ(1, ts.day);
}
Пример #2
0
TEST(TimeHelpersTest, DaysToDateForYear4000)
{
    // generated by http://www.convertunits.com/dates/from/Jan+1,+1970/to/Jan+2,+4000
    std::int64_t const days = 741443;
    SQL_TIMESTAMP_STRUCT ts;
    days_to_date(days, reinterpret_cast<char *>(&ts));
    EXPECT_EQ(4000, ts.year);
    EXPECT_EQ(1, ts.month);
    EXPECT_EQ(2, ts.day);
}