Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Evgeniy Temirgaleev <e.temirgaleev@tarantool.org>,
	Sergey Kaplun <skaplun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 2/2] Make check in os.time() consistent.
Date: Tue, 30 Jun 2026 17:20:35 +0300	[thread overview]
Message-ID: <846468a8-0896-43b6-82fa-f475a8545e01@tarantool.org> (raw)
In-Reply-To: <31cfd9c3c72af4708b03b0ea98ca8a4e913b4599.1782588899.git.e.temirgaleev@tarantool.org>

[-- Attachment #1: Type: text/plain, Size: 1217 bytes --]

Hi, Evgeniy!

Thanks for the patch! LGTM

Sergey

On 6/29/26 20:21, Evgeniy Temirgaleev wrote:
> From: Mike Pall <mike>
>
> Thanks to Temir Galeev. #1470
>
> (cherry picked from commit 295d45fb26de56498782c94594f31b97aef744ef)
>
> This patch prevents os.time() to return nil, when machine time is -1
> and some error occurs before os.time() call. In fact, this is
> a theoretical case, so no tests were added.
>
> Temir Galeev:
> * added the description for the patch
>
> Part of tarantool/tarantool#12480
> ---
>   src/lib_os.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/lib_os.c b/src/lib_os.c
> index f6841357..d4054eae 100644
> --- a/src/lib_os.c
> +++ b/src/lib_os.c
> @@ -229,6 +229,7 @@ LJLIB_CF(os_date)
>   LJLIB_CF(os_time)
>   {
>     time_t t;
> +  errno = 0;
>     if (lua_isnoneornil(L, 1)) {  /* called without args? */
>       t = time(NULL);  /* get current time */
>     } else {
> @@ -242,7 +243,6 @@ LJLIB_CF(os_time)
>       ts.tm_mon = getfield(L, "month", -1) - 1;
>       ts.tm_year = getfield(L, "year", -1) - 1900;
>       ts.tm_isdst = getboolfield(L, "isdst");
> -    errno = 0;
>       t = mktime(&ts);
>     }
>     if (t == (time_t)(-1) && errno != 0)

[-- Attachment #2: Type: text/html, Size: 1662 bytes --]

  parent reply	other threads:[~2026-06-30 14:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29 17:16 [Tarantool-patches] [PATCH luajit 0/2] Fix os.time() to use errno to detect errors Evgeniy Temirgaleev via Tarantool-patches
2026-06-29 17:21 ` [Tarantool-patches] [PATCH luajit 1/2] Fix corner case of os.time() Evgeniy Temirgaleev via Tarantool-patches
2026-06-30 10:05   ` Sergey Kaplun via Tarantool-patches
2026-06-30 13:53     ` Evgeniy Temirgaleev via Tarantool-patches
2026-06-30 14:18   ` Sergey Bronnikov via Tarantool-patches
2026-06-29 17:21 ` [Tarantool-patches] [PATCH luajit 2/2] Make check in os.time() consistent Evgeniy Temirgaleev via Tarantool-patches
2026-06-30 10:08   ` Sergey Kaplun via Tarantool-patches
2026-06-30 13:57     ` Evgeniy Temirgaleev via Tarantool-patches
2026-06-30 14:20   ` Sergey Bronnikov via Tarantool-patches [this message]
2026-06-30 14:55 ` [Tarantool-patches] [PATCH luajit 0/2] Fix os.time() to use errno to detect errors Sergey Kaplun 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=846468a8-0896-43b6-82fa-f475a8545e01@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=e.temirgaleev@tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 2/2] Make check in os.time() consistent.' \
    /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