💾 Archived View for jb55.com › log › 2021-12-06-format-timestamps-anywhere.gmi captured on 2021-12-17 at 13:26:06. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-06)

-=-=-=-=-=-=-

A tool that formats timestamps anywhere

I'm not sure how common this is for other people, but I constantly find myself looking at unix timestamps in logs of various kinds. Whether it's output from an API, or logs from some program. I found it frustrating that I couldn't just convert these timestamps into human-readable dates automagically.

Well frustration no longer! I decided to write a small C program that detects timestamps in any text stream, and formats them.

datefmt

If you find this useful, feel free to package it in your linux distro of choice.

I have a few other programs I have been meaning to properly publish, like another small C program that adds zebra lines to the output of any command. I use this for viewing CSVs in the terminal, when combined with less -S it makes CSVs with long rows a bit more legible. Perhaps I'll save this for a future post.

One new timesaving unix utility a day keeps the doctor away, or so I have been told. I actually have not been told this, and now that I think about it, it's not clear if too many unix utilities is good for you. I suspect too many may drive you mad, but I digress.