time

ulihorn/time/time

No description
time
@/time
SECnumber
time
OUT
SEC
OUT@/time
To use the node in your project you should have the ulihorn/time library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

// When defining a custom type you must declare a C++ type with name `Type`.
// It will be used by the system to store and pass values of the new custom
// type in C++ land.
// In our case the Type is a simple alias for a single number. However, you
// might use a complex struct or class for this role.
using Type = Number;

struct State { };

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    auto sec = getValue<input_SEC>(ctx);
    auto secsInDay = 24 * 60 * 60;

    // Use the `Type` type to define a new variable that will be
    // later output as the result. We use `fmod` to perform day-wrap
    // and be sure the value is in valid range
    Type out = fmod(sec, secsInDay);

    // Then we can output the new type value like a regular one
    emitValue<output_OUT>(ctx, out);
}