Show HN: A Unix timestamp converter that includes the micro and nanoseconds (justquickmath.com)
I find myself having to convert a lot of unix timestamps to a human readable format, but most of the online calculators I found don't include the micro or nanoseconds in the human readable output. It's a small detail, but I find myself having to manually space out the timestamp frequently. I'm learning frontend development, so I made this converter to hopefully make it easier to convert timestamps. Welcome to any feedback :)
26 comments
[ 3.0 ms ] story [ 55.6 ms ] threadThe first result in Google [1] which I often use, lets me paste a unix timestamp in seconds, milliseconds or nano seconds, and it accordingly converts it to a Human readable string.
Is that not the feature you built this for?
[1] - https://www.epochconverter.com/
It looks like it only gives millisecond resolution in the output, and only displays milliseconds if there is at least 1 millisecond. Give it 1677951565020123456 and then you will get 11:39:25.020.
How did this reach the front page?
You shouldn't view someone building a toy project in a negative light, even if it's for learning purposes. It demonstrates curiosity and interest in learning, and is part of what being a hacker is all about.
Maybe it's not frontpage worthy for this crowd, but it's certainly worth mentioning in a CV, especially for junior engineers. It can serve as a good topic of discussion during the interview, for example.
Adjust the format as desired.
Or if there is the number of nsecs rather than the fraction:
date +'%F %H:%M:%S.%N' -d @$(dc -e '9k 16779545532134567654 10 9^/p')
The dc stuff is RPN, k sets the precision, p is print.
When I enter 1e-3, I get 1ms past epoch start, but 1e-4 is 0ms past epoch start. And that isn't what I'd expect.
Here's another odd one, or why I wonder what internal precision things are calculated to:
1234567800000000090.000 is Friday February 2 2009 11:30:00.000,90.,000 PM +00:00 (nanos)
But 1234567800000000090.0001 is Friday February 2 2009 11:30:00.000,0.0,001 PM +00:00 (nanos)
Arguably, UNIX time was really just seconds, but it is handy to have more precision, it just didn't always align with what I'd expect.
That said, this appears like a very minor point, but it's not. This is how bugs are created.
I'll contact the original author as well. This is definitely an issue that should be listed in "falsehoods that programmers believe about time".