The OpenD Programming Language

ionPut

Examples

import mir.timestamp;

ubyte[20] data;

ubyte[] result = [0x68, 0x80, 0x0F, 0xD0, 0x87, 0x88, 0x82, 0x83, 0x84];
auto ts = Timestamp(2000, 7, 8, 2, 3, 4).withOffset(0);
assert(data[0 .. ionPut(data.ptr, ts)] == result);

result = [0x69, 0x80, 0x0F, 0xD0, 0x87, 0x88, 0x82, 0x83, 0x84, 0xC2];
ts = Timestamp(2000, 7, 8, 2, 3, 4, -2, 0).withOffset(0);
assert(data[0 .. ionPut(data.ptr, ts)] == result);

result = [0x6A, 0x80, 0x0F, 0xD0, 0x87, 0x88, 0x82, 0x83, 0x84, 0xC3, 0x10];
ts = Timestamp(2000, 7, 8, 2, 3, 4, -3, 16).withOffset(0);
assert(data[0 .. ionPut(data.ptr, ts)] == result);

Meta