unpack

ulihorn/time/unpack

No description
unpack
@/unpack
IN@/time
unpack
IN
HOUR
MIN
SEC
SECnumber
MINnumber
HOURnumber
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

struct State { };

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    // We use `auto` C++ keyword because the `Type` we defined earlier is in
    // another namespace. The `auto` type instructs the C++ compiler to infer
    // the actual type from a right-hand side expression and it will always
    // match the custom type, be it an alias, struct, or class.
    auto t = getValue<input_IN>(ctx);

    // Now we can use the fetched value as usual. Perform some truncations
    // and modulo divisions to convert seconds to hours, minutes, and seconds
    emitValue<output_SEC>(ctx, fmod(t, 60));
    emitValue<output_MIN>(ctx, fmod(trunc(t / 60), 60));
    emitValue<output_HOUR>(ctx, trunc(t / 3600));
}