Hi Bram, thanks for looking at the issue.

On Wed, Jun 12, 2019 at 07:34:36PM +0200, Bram Moolenaar wrote:
I would guess that localtime() always sets the variables, while localtime_r() is not guaranteed to do that. But it does NOT say that calling tzset() before localtime_r() is required to get correct results.

That is true. I am reporting the issue with a patch that worked for me, and quoting from what seemed to me to be the relevant part of the spec.

I don't know if this is the best way to restore the behaviour I want. Similar to the example code in the patch, I had been setting and restoring the $TZ variable within Vim to set the time zone for a call to strftime(), in order to get UTC timestamps. Restoring the previous time zone afterwards worked correctly until the localtime_r patch. After that patch, it no longer worked. With a call to tzset() added before those calls, per my patch, it works again.

Perhaps tzset() should only be called once, or perhaps only when the $TZ variable was changed?

The latter idea seems good to me. Perhaps even a new function settimezone() could be added, or a new optional parameter for strftime()?

--
Tom Ryder <https://sanctum.geek.nz/>

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20190612211819.GQ27206%40conan.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui