Skip to content

Commit 21a1a63

Browse files
committed
Used standardized time types
1 parent 4997b7d commit 21a1a63

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

examples/common_table_expressions.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
#include <tuple>
1515
#include <iostream>
1616
#include <iomanip>
17+
#ifdef SQLITE_ORM_WITH_CPP20_ALIASES
18+
#include <ctime>
19+
#endif
1720

1821
using std::cout;
1922
using std::endl;
@@ -910,7 +913,7 @@ void neevek_issue_222() {
910913
struct user_activity {
911914
int64 id;
912915
int64 uid;
913-
__time64_t timestamp;
916+
time_t timestamp;
914917
};
915918

916919
auto storage = make_storage("",
@@ -920,7 +923,7 @@ void neevek_issue_222() {
920923
make_column("timestamp", &user_activity::timestamp)));
921924
storage.sync_schema();
922925
storage.transaction([&storage]() {
923-
__time64_t now = _time64(nullptr);
926+
time_t now = std::time(nullptr);
924927
auto values = {user_activity{0, 1, now - 86400 * 3},
925928
user_activity{0, 1, now - 86400 * 2},
926929
user_activity{0, 1, now},
@@ -988,7 +991,7 @@ void greatest_n_per_group() {
988991
struct some_result {
989992
int64 result_id;
990993
int64 item_id;
991-
__time64_t timestamp;
994+
time_t timestamp;
992995
bool flag;
993996
};
994997

@@ -1001,7 +1004,7 @@ void greatest_n_per_group() {
10011004
make_column("flag", &some_result::flag)));
10021005
storage.sync_schema();
10031006
storage.transaction([&storage]() {
1004-
__time64_t now = _time64(nullptr);
1007+
time_t now = std::time(nullptr);
10051008
auto values = std::initializer_list<some_result>{{-1, 1, now - 86400 * 3, false},
10061009
{-1, 1, now - 86400 * 2, true},
10071010
{-1, 1, now, true},

0 commit comments

Comments
 (0)