scandum / tintin

TinTin++, aka tt++, is an extensible console MUD client.
https://tintin.mudhalla.net
GNU General Public License v3.0
199 stars 56 forks source link

feat: support %f for us and %q for ms in #format {%t}, also in #log timestamp #223

Open dzpao opened 4 months ago

dzpao commented 4 months ago

tt's time string formatting methods currently only support those already available in POSIX strftime, which do not include milliseconds and microseconds. This often feels a bit insufficient when printing logs for fine-grained analysis. For this reason I have added support for milliseconds and microseconds.

The %f for microseconds is consistent with Python. Using %q for milliseconds is a no-brainer because I looked at the documentation for strftime and found that almost all the letters (both case and lowercase) were already taken, except %q, which I chose.

Considering that tt++ scripts are less likely to interoperate with other languages, and that timestamping isn't really a high-frequency feature to change, I don't think it should be too much of a problem. Or if you have a better suggestion, please let me know.