[Tarantool-patches] [PATCH resend v2 10/11] lua, datetime: unixtime, timestamp setters in datetime.lua

Timur Safin tsafin at tarantool.org
Sat Jul 31 02:11:28 MSK 2021


Hello Oleg,

: From: Oleg Babin <olegrok at tarantool.org>
: Subject: Re: [Tarantool-patches] [PATCH resend v2 10/11] lua, datetime:
: unixtime, timestamp setters in datetime.lua
: 
: Thanks for your patch.
: 
: The comment is primarly the same as in previous patch.
: 
: Why do you use such slow approach and creates redundant tables and
: function (temporary metatable in fact)
: 
: to use it only once? Please fix it.

In previous emails I've shown how I'd deal with loop invariants. Should
avoid this redundant temp objects problem.

: 
: 
: Unixtime and timestamp is great but they loss precision. I think it
: should be possible
: 
: go get timestamp with nanoseconds precision since datetime has
: nanoseconds precision.

I'm not quite get it. Do you want to have nanoseconds exported via newindex?
For direct assignments? It's not useful because of available .nsec field.
Or may be you meant something else?

: 
: 
: Also still it's hard how to convert timestamp to datetime value back.

Timestamp is something secs.nsec, what looks complicated? I'm confused.
Could you please elaborate?

: 
: 
: On 28.07.2021 13:34, Timur Safin via Tarantool-patches wrote:
: > * implemented proper range checks for date attributes values;
: >
: > * created `.unixtime` attribute, which is alias to `.secs`,
: >    with corresponding setter/getter;
: >
: > * similarly to `unixtime`, created virtual `timestamp` attribute
: >    setter. Which is a convenient way to simultaneously assign
: >    unixtime (seconds since epoch) and nanoseconds
: >
: > Part of #5941

Thanks,
Timur



More information about the Tarantool-patches mailing list