1 #include <sol/test_main.cpp>
2 #include <sol/date_time/utc_time.hpp>
3 #include <sol/date_time/hiresolution_clock.hpp>
7 namespace sol
{ namespace test
{
10 namespace date_time
= sol::date_time
;
14 run (std::vector
<std::string
> const &args
)
16 date_time::utc_time
now(date_time::hiresolution_clock::universal_time());
18 sol_info("hiresolution clock");
20 date_time::utc_time
t1(now
+ date_time::seconds(1));
21 sol_equal(now
.seconds_since_epoch() + 1, t1
.seconds_since_epoch());
23 std::time_t t2(std::time(0));
24 sol_equal((t2
- now
.seconds_since_epoch()) <= 1, true);
28 sol_info("comparison");
30 date_time::utc_time t2
;
32 sol_equal((now
== t2
), false);
33 sol_equal((now
!= t2
), true);
34 sol_equal((now
> t2
), true);
35 sol_equal((now
>= t2
), true);
36 sol_equal((now
< t2
), false);
37 sol_equal((now
<= t2
), false);
40 sol_equal((now
== t2
), true);
41 sol_equal((now
!= t2
), false);
42 sol_equal((now
> t2
), false);
43 sol_equal((now
>= t2
), true);
44 sol_equal((now
< t2
), false);
45 sol_equal((now
<= t2
), true);
47 t2
= now
+ date_time::seconds(1);
48 sol_equal((now
== t2
), false);
49 sol_equal((now
!= t2
), true);
50 sol_equal((now
> t2
), false);
51 sol_equal((now
>= t2
), false);
52 sol_equal((now
< t2
), true);
53 sol_equal((now
<= t2
), true);
61 }} // namespace sol::test