Readit News logoReadit News
nalgeon commented on Micro-libraries should never be used   bvisness.me/microlibrarie... · Posted by u/nalgeon
nalgeon · a year ago
The title of the article is "Micro-libraries need to die already". Renaming the submission to "Micro-libraries should never be used" is pathetic, Daniel. I'm not surprised though.
nalgeon commented on Show HN: High-precision date/time in SQLite   antonz.org/sqlean-time/... · Posted by u/nalgeon
alberth · a year ago
@nalgeon

Do you plan to address the use cases in the SO post, or asked differently - what is the intended use case of this library?

I tried to recreate it on your site (which is very cool btw in allowing the code to run in browser) and it seems to fail and give the wrong time difference.

  select time_compare(time_date(1927, 12, 31, 23, 58, 08, 0, 28800000), time_date(1927, 12, 31, 23, 58, 09, 0, 28800000));
Results in an answer of '1', which is incorrect.

Please don't take my comments as being negative or unappreciated, this is super difficult stuff and anyone who tries to make the world an easier place should be thanked for that. So thank you.

----

EDIT: this post explains why the answer isn't "1"

https://stackoverflow.com/questions/6841333/why-is-subtracti...

nalgeon · a year ago
I appreciate your comments, and thank you for trying out the extension.

This query returns -1 (minus one, not one), which seems correct to me. The first date is before the second:

    select time_compare(
      time_date(1927, 12, 31, 23, 58, 08, 0, 28800000),
      time_date(1927, 12, 31, 23, 58, 09, 0, 28800000)
    );

    -1

Deleted Comment

nalgeon commented on Show HN: High-precision date/time in SQLite   antonz.org/sqlean-time/... · Posted by u/nalgeon
sltkr · a year ago
This library doesn't deal with the notion of local time at all. It's all UTC-based times, possibly with a user-supplied timezone offset, but then the hard part of calculating the timezone offset must be done by the caller.

I do think the documentation could be a little clearer. The author talks about “time zones” but the library only deals with time zone offsets. (A time zone is something like America/New_York, while a time zone offset is the difference to UTC time, which is -14400 seconds for New York today, but will be -18000 in a few months due to daylight saving time changes.)

nalgeon · a year ago
Thanks for the suggestion! True, only fixed offsets are supported, not timezone names.
nalgeon commented on Show HN: High-precision date/time in SQLite   antonz.org/sqlean-time/... · Posted by u/nalgeon
out_of_protocol · a year ago
Why not go golang style, unix timestamp as nanoseconds, in signed int64. Maybe you can't cover millions of years with nanosecond precision, do you really need it?
nalgeon · a year ago
Storing unix timestamp as nanoseconds is not Go's style, but you can do just that with this extension.

    select time_to_nano(time_now());
    -- 1722979335431295000

Dead Comment

nalgeon commented on Show HN: High-precision date/time in SQLite   antonz.org/sqlean-time/... · Posted by u/nalgeon
zokier · a year ago
I just wish people would stop using the phrase "seconds since epoch" (or equivalent) unless that is exactly what they mean.

I wonder what does

    select time_sub(time_date(2011, 11, 19), time_date(1311, 11, 18));
return?

nalgeon · a year ago
> If the result exceeds the maximum value that can be stored in a Duration, the maximum duration will be returned.

u/nalgeon

KarmaCake day6898December 12, 2016
About
antonz.org
View Original