Note that there are some explanatory texts on larger screens.

plurals
  1. POMinGW MSYS, MSVCRT, and the TZ environment variable
    primarykey
    data
    text
    <p>In short, how to make both MSVCRT and MinGW MSYS share the TZ environment variable without conflicts? Or, how to make both support timezones without conflicts?</p> <h2>Further information</h2> <p>In order to have date command of MSYS displaying correct local time, and because MSYS itself uses its own C runtime instead of MSVCRT, I have set TZ environment variable <a href="http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html" rel="nofollow noreferrer">according to GNU C library documentation</a>:</p> <pre><code>export TZ="BRT+3BRST,M10.3.0/0,M2.3.0/0" </code></pre> <p>Unfortunately, <a href="http://msdn.microsoft.com/en-us/library/90s5c885%28v=vs.80%29.aspx" rel="nofollow noreferrer">this conflicts with Microsoft C runtime specs</a>, which dictates for the DST name part:</p> <blockquote> <p><em>If daylight saving time is never in effect in the locality, set TZ without a value for dzn. The C run-time library assumes the United States' rules for implementing the calculation of daylight saving time (DST)</em></p> </blockquote> <p>Hence, the simple presence of a DST name in TZ variable will cause programs relying on <code>_tzset</code> to malfunction outside the USA. This is my case with Bazaar DVCS, where I have been getting wrong commit times, one hour late, because MSVCRT assumes I have already entered DST period based on TZ setting. If I leave TZ empty, MSYS date displays UTC time, but MSVCRT (and Bazaar) works just fine. If I set TZ as above, then MSVCRT adds one hour to commit times, but MSYS date displays local time.</p> <p>Bazaar is affected because it uses Python which in turn uses MSVCRT under Windows. Even though I can remove everything from DST name on, that will break date command in MSYS. I have tried several values of TZ as well. MSYS seems to lack any further timezone support than what is described above in GNU reference. Also, I wanted to avoid having TZ not set only when invoking Bazaar, or have it set only when invoking date command, but rather a more general solution.</p> <p><strong>Alternative formats and zoneinfo database</strong></p> <p>There is an alternative format for TZ, third one in GNU documentation above, but it seems to not be supported by MSYS, as stated:</p> <blockquote> <p><em>But the POSIX.1 standard only specifies the details of the first two formats,</em></p> </blockquote> <p>It seems this third format is just IANA's Time Zone Database, <a href="http://www.iana.org/time-zones/repository/tz-link.html" rel="nofollow noreferrer">which describes a different format for TZ</a> which seems to not be supported by MSYS either, as stated:</p> <blockquote> <p><em>To use the database on an extended POSIX implementation set the TZ environment variable to the location's full name, e.g., <code>TZ="America/New_York"</code>.</em></p> </blockquote> <p>Desipe the above I tried to install IANA's zoneinfo manually onto MSYS without success. I'm not sure if these statements are correct and their formats aren't even recognized by MSYS, or if I just have failed to install zoneinfo data files correctly. I couldn't find a compiled version neither could I compile myself, so I just tried out the tzdata package from Ubuntu.</p> <p>Something odd to me, though, is that GNU C library documentation above stands it comes with a timezone database already (it sounds to me like zoneinfo). However as said I can't find any kind of timezone database installed anywhere in MSYS, neither I can find any mingw-get package related to timezones. I wonder if the developers simply removed it from the release. This is what the documentation says:</p> <blockquote> <p><em>The GNU C Library comes with a large database of time zone information for most regions of the world, which is maintained by a community of volunteers and put in the public domain.</em></p> </blockquote> <p>So in sum, if I could make zoneinfo or similar alternative work in MSYS, then I could abandon my current approach of setting TZ as above. I can't find, however, any good information about timezone support in MSYS.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload