I want to format a timestamp obtained from a system call.

C: strftime() is available everywhere and no memory allocation needed.

Rust: Nothing in the standard lib, choose between various crates that can do this, figure out how to convert between SystemTime and whatever the crate has. Everything returns a newly allocated string.

All in all I wouldn't want to go back to C, but not everything is easier in in . :blobshrug:

Follow

Turns out I was (probably) wrong about the memory allocation part. Both the time and humantime crates have types that implement the Display trait, these can be used in a non-allocating manner and are (presumably) more efficient than allocating new strings.

(I haven't benchmarked a thing yet)

Sign in to participate in the conversation
niu.moe

We are a cute and loving international community O(≧▽≦)O !