On Wednesday, 25 March 2015 at 17:09:05 UTC, John Colvin wrote:
As per the signature in the docs:

void append(T, Endian endianness = Endian.bigEndian, R)(R range, T value)

The endianness is the second template argument. What you need to write is

buffer.append!(uint, Endian.littleEndian)(cast(uint)stdTimeToUnixTime(Clock.currStdTime));

or

append!(uint, Endian.littleEndian)(buffer, cast(uint)stdTimeToUnixTime(Clock.currStdTime));

Note that you don't need to specify the third template argument, that will be inferred automatically from the type of `buffer`

Hmm... the examples for append in the documentation look very different from the syntax you have suggested. No wonder.

In any case, I have tried the code with the first way you suggested, and append actually does not append to the buffer, but... rewrites the buffer!

Since the buffer is not static, shouldn't append actually do that?

Reply via email to