<HTML><BODY><div class="cl-02nkxgmzo6"><div class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr"><div id="style_17828262880892559139_mr_css_attr"><div id="style_17828262880892559139_BODY_mr_css_attr"><div class="cl-0ptzgq595v_mr_css_attr"><div>Hi, Sergey!</div><div>Thanks for the review!</div><div>Fixed your comments and force-pushed the branch.</div><div class="mail-quote-collapse_mr_css_attr"><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px"><span><span>From: Sergey Kaplun <<a href="mailto:skaplun@tarantool.org">skaplun@tarantool.org</a>><br>To: Evgeniy Temirgaleev <<a href="mailto:e.temirgaleev@tarantool.org">e.temirgaleev@tarantool.org</a>><br>Cc: Sergey Bronnikov <<a href="mailto:sergeyb@tarantool.org">sergeyb@tarantool.org</a>>,<a href="mailto:tarantool-patches@dev.tarantool.org">tarantool-patches@dev.tarantool.org</a><br>Date: Tuesday, June 30, 2026 1:06 PM +03:00</span></span> <div> <div><div id=""><div class="cl-a8epmwnrit_mr_css_attr"><div class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr"><div id="style_17828139650082621570_mr_css_attr"><div id="style_17828139650082621570_BODY_mr_css_attr">Hi, Evgeniy!<br>Thanks for the patch!<br>LGTM, with minor nits below.<br><br>On 29.06.26, Evgeniy Temirgaleev wrote:<br>> From: Mike Pall <mike><br>><br>> Thanks to Temir Galeev. #1470</div></div></div></div></div></div></div></blockquote></div></div></div></div></div></div></div><div class="cl-02nkxgmzo6"><div class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr"><div><div><div class="cl-0ptzgq595v_mr_css_attr"><div class="mail-quote-collapse_mr_css_attr"><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px"><div><div><div><div class="cl-a8epmwnrit_mr_css_attr"><div class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr"><div><div><br>Please strip the issue number to avoid overmentioning the ticket on<br>GitHub. (The Issue can be easily found by the cherry-picked commit,<br>though). This helps to avoid overmentioning during the review and<br>applying the patch to long-term branches.</div></div></div></div></div></div></div></blockquote></div></div></div></div></div></div></div><div>Removed.</div><div class="cl-02nkxgmzo6"><div class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr"><div><div><div class="cl-0ptzgq595v_mr_css_attr"><div class="mail-quote-collapse_mr_css_attr"><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px"><div><div><div><div class="cl-a8epmwnrit_mr_css_attr"><div class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr"><div><div><br>><br>> (cherry picked from commit 72d2061ae2fa9a5fd45237943f9982baf59435ec)<br>><br>> This patch fixes invalid os.time(t) behavior, when it handles -1 time value<br><br>Typo: s/, when/ when/<br>Typo: s/-1/the -1/</div></div></div></div></div></div></div></blockquote></div></div></div></div></div></div></div><div>Fixed.</div><div class="cl-02nkxgmzo6"><div class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr"><div><div><div class="cl-0ptzgq595v_mr_css_attr"><div class="mail-quote-collapse_mr_css_attr"><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px"><div><div><div><div class="cl-a8epmwnrit_mr_css_attr"><div class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr"><div><div><br>> as a fail of the libc mktime() regardless of the errno value.<br>><br>> Temir Galeev:<br>> * added the description and the test for the patch<br>><br>> Part of tarantool/tarantool#12480<br>> ---<br>> src/lib_os.c | 3 ++-<br>> .../lj-1470-os-time-epoch-minus-1s.test.lua | 12 ++++++++++++<br>> 2 files changed, 14 insertions(+), 1 deletion(-)<br>> create mode 100644 test/tarantool-tests/lj-1470-os-time-epoch-minus-1s.test.lua<br>><br>> diff --git a/src/lib_os.c b/src/lib_os.c<br>> index ffbc3fdc..f6841357 100644<br>> --- a/src/lib_os.c<br>> +++ b/src/lib_os.c<br>> @@ -242,9 +242,10 @@ LJLIB_CF(os_time)<br>> ts.tm_mon = getfield(L, "month", -1) - 1;<br>> ts.tm_year = getfield(L, "year", -1) - 1900;<br>> ts.tm_isdst = getboolfield(L, "isdst");<br>> + errno = 0;<br>> t = mktime(&ts);<br>> }<br>> - if (t == (time_t)(-1))<br>> + if (t == (time_t)(-1) && errno != 0)<br>> lua_pushnil(L);<br>> else<br>> lua_pushnumber(L, (lua_Number)t);<br>> diff --git a/test/tarantool-tests/lj-1470-os-time-epoch-minus-1s.test.lua b/test/tarantool-tests/lj-1470-os-time-epoch-minus-1s.test.lua<br>> new file mode 100644<br>> index 00000000..6b5703e4<br>> --- /dev/null<br>> +++ b/test/tarantool-tests/lj-1470-os-time-epoch-minus-1s.test.lua<br>> @@ -0,0 +1,12 @@<br>> +local tap = require('tap')<br>> +<br>> +-- The test file demonstrates os.time() fail to return -1 time value.<br><br>Side note: It looks like the patch is outdated compared to the branch.</div></div></div></div></div></div></div></blockquote></div></div></div></div></div></div></div><div>Yes, thanks!</div><div class="cl-02nkxgmzo6"><div class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr"><div><div><div class="cl-0ptzgq595v_mr_css_attr"><div class="mail-quote-collapse_mr_css_attr"><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px"><div><div><div><div class="cl-a8epmwnrit_mr_css_attr"><div class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr"><div><div><br>> +-- See also: <a href="https://github.com/LuaJIT/LuaJIT/issues/1470">https://github.com/LuaJIT/LuaJIT/issues/1470</a>.<br>> +local test = tap.test('lj-1470-os-time-epoch-minus-1s')<br>> +<br>> +test:plan(1)<br>> +<br>> +local minus_1s_time = os.date("*t", -1)<br><br>Nit: We use everywhere in Lua code single quotes if possible (see other<br>tests).</div></div></div></div></div></div></div></blockquote></div></div></div></div></div></div></div><div>Fixed.</div><div>======================================</div><div><div><div>diff --git a/test/tarantool-tests/lj-1470-os-time-epoch-minus-1s.test.lua b/test/tarantool-tests/lj-1470-os-time-epoch-minus-1s.test.lua</div><div>index aa913607..dfe1ee11 100644</div><div>--- a/test/tarantool-tests/lj-1470-os-time-epoch-minus-1s.test.lua</div><div>+++ b/test/tarantool-tests/lj-1470-os-time-epoch-minus-1s.test.lua</div><div>@@ -7,7 +7,7 @@ local test = tap.test('lj-1470-os-time-epoch-minus-1s')</div><div> </div><div> test:plan(1)</div><div> </div><div>-local minus_1s_time = os.date("*t", -1)</div><div>+local minus_1s_time = os.date('*t', -1)</div><div> test:is(os.time(minus_1s_time), -1, 'correct os.time()')</div><div> </div><div> test:done(true)</div><div>======================================</div></div></div><div class="cl-02nkxgmzo6"><div class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr"><div><div><div class="cl-0ptzgq595v_mr_css_attr"><div class="mail-quote-collapse_mr_css_attr"><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px"><div><div><div><div class="cl-a8epmwnrit_mr_css_attr"><div class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr"><div><div><br>> +test:is(os.time(minus_1s_time), -1, 'correct os.time()')<br>> +<br>> +test:done(true)<br>> --<br>> 2.49.0<br>><br><br>--<br>Best regards,<br>Sergey Kaplun</div></div></div></div></div></div></div></blockquote></div></div></div><div> </div><div><div>--<br>Best regards,</div><div>Evgeniy Temirgaleev</div></div></div></div></div></div></BODY></HTML>