3 ms·
> "d": <unsigned int of minutes passed from epoch until when item was created>, I know it's a simple /60, but why change from the more-or-less standard secon
by jimktrains2 11y ago
> "d": <unsigned int of minutes passed from epoch until when item was created>,
I know it's a simple /60, but why change from the more-or-less standard seconds from epoch? To try to squeeze more time out of a 32bit unsigned integer? Since there is no discussion of what size this integer is, I'm expecting you're just defaulting to the json standard, which would support a 53-bit signed integer, iirc.
- sktrdie 11y agoYeah it's just a matter of saving space. Here's the actual code: https://github.com/lmatteis/peer-tweet/blob/master/app/components/Tweet.js#L77 https://github.com/lmatteis/peer-tweet/blob/master/app/compo... I'm really bad at binary arithmetic so I might have done something wrong, but essentially I calculate how many bytes I need to use for the integer, and I store it in a buffer. I might change this if the space required is the same for seconds. I just figured I'd save some space, and I only need minute precision really.
- dTal 11y agoMy personal intuition is that the tiny space savings isn't worth the creation of a new timestamp format that will undoubtedly cause frustration down the line, if this catches on.
- Franciscouzo 11y agoActually JSON doesn't mentions a limit on numbers http://stackoverflow.com/a/13502497/1192111 http://stackoverflow.com/a/13502497/1192111