diff-seconds

xod/datetime/diff-seconds

Calculates the difference between two datetimes in seconds
diff-seconds
@/diff-seconds
Calculates the difference between two datetimes in seconds
IN1@/datetime
IN2@/datetime
diff-seconds
IN1
IN2
OUT
OUTnumber
Difference in seconds. It is negative if IN1 precedes IN2

C++ implementation

node {
    void evaluate(Context ctx) {
        auto x = getValue<input_IN1>(ctx);
        auto y = getValue<input_IN2>(ctx);
        int32_t res = x > y ? x - y : -1 * (y - x);
        emitValue<output_OUT>(ctx, res);
    }
}