]> git.lizzy.rs Git - rust.git/commit
libtime: alter strftime to use a TmFmt
authorSean McArthur <sean.monstar@gmail.com>
Wed, 3 Sep 2014 21:56:35 +0000 (14:56 -0700)
committerSean McArthur <sean.monstar@gmail.com>
Sat, 8 Nov 2014 01:49:40 +0000 (17:49 -0800)
commit7ddf8cb0e02549e6df7afe7e8486d735f8ee7eae
tree52efef8f11f9d34186d16cbc876cbe885bb2557e
parent6ee56c9a5febad45865b7d41422b7ae4d996fcaa
libtime: alter strftime to use a TmFmt

The internals of strftime were converted to use a single formatter,
instead of creating and concatenating a bunch of small strings. This
showed ~3x improvement in the benches.

Also, since the formatted time may be going straight to a Writer, TmFmt
was introduced, and is returned from all formatting methods on Tm. This
allows the saving of another string allocation. Anyone wanting a String
can just call .to_string() on the returned value.

[breaking-change]
src/libtime/lib.rs