7 #include <hilti/ast/builder/type.h> 8 #include <hilti/ast/operators/common.h> 9 #include <hilti/ast/types/integer.h> 10 #include <hilti/ast/types/interval.h> 11 #include <hilti/ast/types/real.h> 12 #include <hilti/ast/types/time.h> 17 STANDARD_OPERATOR_2(time, Equal, type::Bool(), type::Time(), type::Time(),
"Compares two time values.")
18 STANDARD_OPERATOR_2(time, Unequal, type::Bool(), type::Time(), type::Time(), "Compares two time values.")
19 STANDARD_OPERATOR_2x(time, SumInterval, Sum, type::Time(), type::Time(), type::Interval(),
20 "Adds the interval to the time.");
21 STANDARD_OPERATOR_2x(time, DifferenceTime, Difference, type::Interval(), type::Time(), type::Time(),
22 "Returns the difference of the times.");
23 STANDARD_OPERATOR_2x(time, DifferenceInterval, Difference, type::Time(), type::Time(), type::Interval(),
24 "Subtracts the interval from the time.");
25 STANDARD_OPERATOR_2(time, Greater, type::Bool(), type::Time(), type::Time(), "Compares the times.");
26 STANDARD_OPERATOR_2(time, GreaterEqual, type::Bool(), type::Time(), type::Time(), "Compares the times.");
27 STANDARD_OPERATOR_2(time, Lower, type::Bool(), type::Time(), type::Time(), "Compares the times.");
28 STANDARD_OPERATOR_2(time, LowerEqual, type::Bool(), type::Time(), type::Time(), "Compares the times.");
30 BEGIN_METHOD(time, Seconds)
31 auto signature()
const {
32 return Signature{.self = type::Time(), .result = type::Real(), .id =
"seconds", .args = {}, .doc = R
"( 33 Returns the time as a real value representing seconds since the UNIX epoch. 38 BEGIN_METHOD(time, Nanoseconds) 39 auto signature()
const {
40 return Signature{.self = type::Time(),
41 .result = type::UnsignedInteger(64),
45 Returns the time as an integer value representing nanoseconds since the UNIX epoch.