pebble-dev / RebbleOS

open source operating system for low-power smartwatches
Other
355 stars 38 forks source link

strftime should truncate instead of returning \0 #65

Closed ginge closed 5 years ago

ginge commented 5 years ago

If you request a format such as %T (:H:%M:%S) and don't provide a buffer long enough, then it will return an empty buffer back.

PebbleOS will return the last usable chunks that fit. For example using %T with a buflen of 6 should return "HH:MM" instead of the intended "HH:MM:SS"

Helco commented 5 years ago

Small sidenote that this is a extension to the standard, but I can see why it would be useful