Tarantool development patches archive
 help / color / mirror / Atom feed
From: "Dmitry E. Oboukhov via Tarantool-patches" <tarantool-patches@dev.tarantool.org>
To: Safin Timur <tsafin@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v6 3/5] box, datetime: datetime comparison for indices
Date: Thu, 19 Aug 2021 17:47:39 +0300	[thread overview]
Message-ID: <YR5vC+3PFfL8nnQU@unera> (raw)
In-Reply-To: <c786104a-a3e1-e710-afcf-5d66e0608411@tarantool.org>

> > The code looks like as broken.
> 
> Not exactly :)
> 
> .new{} is constructor which is not expecting string at the moment. .parse()
> expect strings, or defaul __call handler for the module, which is
> dispatching between parsing, if passed string, and, direct calling
> constructor, if there are no arguments passed or they are object.

If .new and .__call are different, .new have to throw an exception
instead creating object with zero in its timestamp.

I think it would be nice to drop '__call' method and patch 'new' for
work with strings (mainstream) and tables (rare cases)

> diff --git a/src/lib/core/datetime.c b/src/lib/core/datetime.c
> index ebc05e29c..6e2a76da5 100644
> --- a/src/lib/core/datetime.c
> +++ b/src/lib/core/datetime.c
> @@ -93,20 +93,17 @@ datetime_to_string(const struct datetime *date, char

I can't apply the patch:

> patching file src/lib/core/datetime.c
> patch: **** malformed patch at line 4: *buf, int len)

I think it isn't between previous and current versions.

> ------------------------------------------------
> >  2. also the other databases try to avoid to use «Z» symbol in
> >     datetime-format, so I thing we should use «+00:00» instead «Z»
> 
> I don't care which way to output UTC, but here I need more examples (which
> vendor, how and when outputs timezone)...
> 
> Like - here is DATE WITH TIMEZONE column, and here is DATE WITHOUT TIMEZONE.
> And here TIMESTAMP WITHOUT TIMEZONE, and with UTC, and we see...

Example Postgresql

unera=> SET TIME ZONE 'ZULU';
SET
unera=> select '2021-08-19 17:36:14+0300'::TIMESTAMPTZ(0);
      timestamptz       
------------------------
 2021-08-19 14:36:14+00
(1 строка)

unera=> select '2021-08-19 17:36:14Z'::TIMESTAMPTZ(0);
      timestamptz       
------------------------
 2021-08-19 17:36:14+00
(1 строка)

Even if you set current timezone to 'Z' it prints zone as number.
So user can sort these strings as strings and sort will be correct.


> 
> > 
> > Yesterday we approved the following API:
> > T:add{year=XXX, month=YYY, ...}
> > T:sub{year=XXX, month=YYY, ...}
> > T:set{year=XXX, …, tz=’+03:00’}
> > T:strftime(‘%F %D %z’)
> > I want to see a test set for the API.
> 
> FWIW, :add{}/:sub{}/:strftime{} are there, but not :set() as unimplemented
> yet.

Ok, I think we need to have test for each method.
 
> > Datetime object must have methods to return integer and float timestamp:
> > T:epoch()
> > T:timestamp()
> 
> epoch() is integer, and timestamp() is double, correct?
ok

-- 

. ''`.            Dmitry E. Oboukhov <unera@debian.org>
: :’  :                           <unera@tarantool.org>
`. `~’                  work: <d.oboukhov@corp.mail.ru>
  `- 71ED ACFC 6801 0DD9 1AD1  9B86 8D1F 969A 08EE A756

  reply	other threads:[~2021-08-21  6:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19  2:56 [Tarantool-patches] [PATCH v6 0/5] Initial datetime implementation Timur Safin via Tarantool-patches
2021-08-19  2:56 ` [Tarantool-patches] [PATCH v6 1/5] build, lua: built-in module datetime Timur Safin via Tarantool-patches
2021-08-19  9:43   ` Serge Petrenko via Tarantool-patches
2021-08-19  9:47     ` Safin Timur via Tarantool-patches
2021-08-19 15:26   ` Vladimir Davydov via Tarantool-patches
2021-08-24 21:13     ` Vladislav Shpilevoy via Tarantool-patches
2021-08-19  2:56 ` [Tarantool-patches] [PATCH v6 2/5] box, datetime: messagepack support for datetime Timur Safin via Tarantool-patches
2021-08-19  9:58   ` Serge Petrenko via Tarantool-patches
2021-08-19  2:56 ` [Tarantool-patches] [PATCH v6 3/5] box, datetime: datetime comparison for indices Timur Safin via Tarantool-patches
2021-08-19 10:16   ` Serge Petrenko via Tarantool-patches
2021-08-19 11:18   ` UNera via Tarantool-patches
2021-08-19 11:53     ` Safin Timur via Tarantool-patches
2021-08-19 14:47       ` Dmitry E. Oboukhov via Tarantool-patches [this message]
2021-08-19  2:56 ` [Tarantool-patches] [PATCH v6 4/5] datetime: perf test for datetime parser Timur Safin via Tarantool-patches
2021-08-19 10:19   ` Serge Petrenko via Tarantool-patches
2021-08-19 10:29     ` Safin Timur via Tarantool-patches
2021-08-19 11:11       ` Serge Petrenko via Tarantool-patches
2021-08-19 15:58       ` Vladimir Davydov via Tarantool-patches
2021-08-19  2:56 ` [Tarantool-patches] [PATCH v6 5/5] datetime: changelog for datetime module Timur Safin via Tarantool-patches
2021-08-19 10:20   ` Serge Petrenko via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YR5vC+3PFfL8nnQU@unera \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=d.oboukhov@corp.mail.ru \
    --cc=tsafin@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v6 3/5] box, datetime: datetime comparison for indices' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox