Live data from Hacker News

Show HN: A Unix timestamp converter that includes the micro and nanoseconds

justquickmath.com

11–20 of 27 posts

Re: Show HN: A Unix timestamp converter that includes the micro and nanoseconds

#12
post #6

Doesn't 'date' do this on the commabd line?

date +'%F %H:%M:%S.%N' -d @1677954553.2134567654

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.

Re: Show HN: A Unix timestamp converter that includes the micro and nanoseconds

#15
post #3

Mate, I'm very confused. The 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/

Exactly. I've been using epoch converter for years. It's the first thing that comes up in search results too. How did this reach the front page?

As someone involved in a lot of hiring, it's very common especially for junior developers (which OP appears to be) to pad their resumes with many toy web apps that effectively wrap or replicate simple Unix tools. I have noticed this trend a lot in the last year or two. It does give those applicants a leg up for sure, especially in this market, but do only take these projects at face value.

Re: Show HN: A Unix timestamp converter that includes the micro and nanoseconds

#16

Reminds me of a call I was on a few weeks ago where someone went off that Unix epoch with milliseconds wasn’t the Unix epoch. Made it a huge point that it wasn’t and would correct everyone who tried to refer to it as that. I did Google it and he technically is right. But it’s also a stupid hill to die on.

Your colleague is absolutely correct. That was the same objection I had to this. Unix timestamp format is only seconds. This page shows a timestamp but not a Unix timstamp, so the hill people are dying on here is to take and reuse a name for a different format out of their own stubborness - even after they learned they are wrong. It's very confusing and rejected by tools that only work with unix timestamps.

That said, this appears like a very minor point, but it's not. This is how bugs are created.

Re: Show HN: A Unix timestamp converter that includes the micro and nanoseconds

#17

Earlier quoted context omitted.

Exactly. I've been using epoch converter for years. It's the first thing that comes up in search results too. How did this reach the front page?

As someone involved in a lot of hiring, it's very common especially for junior developers (which OP appears to be) to pad their resumes with many toy web apps that effectively wrap or replicate simple Unix tools. I have noticed this trend a lot in the last year or two. It does give those applicants a leg up for sure, especially in this market, but do only take these projects at face value.

At the same time, we celebrate rewriting small Unix tools in Rust. How is that different?

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.

Re: Show HN: A Unix timestamp converter that includes the micro and nanoseconds

#19
post #8

Looks like you have varying precision with date, might be using floating point?

What do you mean by varying precision? Do you have an example? Thanks

At first I didn't understand the input format, which seems to try and autodetect the units.

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.

Re: Show HN: A Unix timestamp converter that includes the micro and nanoseconds

#20
post #16

Reminds me of a call I was on a few weeks ago where someone went off that Unix epoch with milliseconds wasn’t the Unix epoch. Made it a huge point that it wasn’t and would correct everyone who tried to refer to it as that. I did Google it and he technically is right. But it’s also a stupid hill to die on.

Your colleague is absolutely correct. That was the same objection I had to this. Unix timestamp format is only seconds. This page shows a timestamp but not a Unix timstamp, so the hill people are dying on here is to take and reuse a name for a different format out of their own stubborness - even after they learned they are wrong. It's very confusing and rejected by tools that only work with unix timestamps. That said…

exactly. people using milliseconds and calling it a unix timestamp are wrong. provably wrong. so for them to dig in, or anything other than say "oh you are right, sorry", is just a waste of everyone's time. Accept that you made a mistake, and move on.
Post reply on HN