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> 16 STANDARD_OPERATOR_2(time, Equal, type::Bool(), type::Time(), type::Time(),
"Compares two time values.")
17 STANDARD_OPERATOR_2(time, Unequal, type::Bool(), type::Time(), type::Time(), "Compares two time values.")
18 STANDARD_OPERATOR_2x(time, SumInterval, Sum, type::Time(), type::Time(), type::Interval(),
19 "Adds the interval to the time.");
20 STANDARD_OPERATOR_2x(time, DifferenceTime, Difference, type::Interval(), type::Time(), type::Time(),
21 "Returns the difference of the times.");
22 STANDARD_OPERATOR_2x(time, DifferenceInterval, Difference, type::Time(), type::Time(), type::Interval(),
23 "Subtracts the interval from the time.");
24 STANDARD_OPERATOR_2(time, Greater, type::Bool(), type::Time(), type::Time(), "Compares the times.");
25 STANDARD_OPERATOR_2(time, GreaterEqual, type::Bool(), type::Time(), type::Time(), "Compares the times.");
26 STANDARD_OPERATOR_2(time, Lower, type::Bool(), type::Time(), type::Time(), "Compares the times.");
27 STANDARD_OPERATOR_2(time, LowerEqual, type::Bool(), type::Time(), type::Time(), "Compares the times.");
29 STANDARD_KEYWORD_CTOR(time, CtorSignedIntegerNs, "time_ns", type::Time(), type::SignedInteger(type::Wildcard()),
30 "Creates an time interpreting the argument as number of nanoseconds.");
31 STANDARD_KEYWORD_CTOR(time, CtorSignedIntegerSecs, "time", type::Time(), type::SignedInteger(type::Wildcard()),
32 "Creates an time interpreting the argument as number of seconds.");
33 STANDARD_KEYWORD_CTOR(time, CtorUnsignedIntegerNs, "time_ns", type::Time(), type::UnsignedInteger(type::Wildcard()),
34 "Creates an time interpreting the argument as number of nanoseconds.");
35 STANDARD_KEYWORD_CTOR(time, CtorUnsignedIntegerSecs, "time", type::Time(), type::UnsignedInteger(type::Wildcard()),
36 "Creates an time interpreting the argument as number of seconds.");
37 STANDARD_KEYWORD_CTOR(time, CtorRealSecs, "time", type::Time(), type::Real(),
38 "Creates an time interpreting the argument as number of seconds.");
40 BEGIN_METHOD(time, Seconds)
41 const auto& signature()
const {
42 static auto _signature =
43 Signature{.self = type::Time(), .result = type::Real(), .id =
"seconds", .args = {}, .doc = R
"( 44 Returns the time as a real value representing seconds since the UNIX epoch. 50 BEGIN_METHOD(time, Nanoseconds)
51 const auto& signature()
const {
52 static auto _signature = Signature{.self = type::Time(),
53 .result = type::UnsignedInteger(64),
57 Returns the time as an integer value representing nanoseconds since the UNIX epoch. Definition: operator-registry.h:15