From: Konrad H. <ko...@pa...> - 2012-10-17 10:23:11
|
Renato Silva [mailto:br....@gm...] On Tuesday, October 16, 2012 6:15 PM Em 16/10/2012 13:47, "Konrad Hambrick" <ko...@pa...<mailto:ko...@pa...>> escreveu: > Renato Silva [mailto:br....@gm...<mailto:br....@gm...>] said: > On Tuesday, October 16, 2012 10:40 AM > Em 16/10/2012 08:57, "Earnie Boyd" <ea...@us...<mailto:ea...@us...>> escreveu: > > > > On Tue, Oct 16, 2012 at 12:43 AM, Renato Silva wrote: > > > It is too long to copy and paste, and I tried to explain the problem quite > > > well, so I'm just linking: > > > > > > http://stackoverflow.com/questions/12765650/mingw-msys-msvcrt-and-the-tz-environment-variable > > > > > > Can anyone give clear information as explained in the above link? > > > > I posted the below as an answer to the above link. > > > > The simple solution is to set your windows environment variable as you > > expect then change the variable in your ~/.profile file for MSYS to > > what POSIX expects. > > I'm sorry but that's the very problem not a solution :( Maybe it wasn't clear but I'm already setting TZ from within MSYS (in /etc/profile), and I run MSVCRT programs from within Bash, so whatever it was in Windows gets overwritten. In Windows, I need TZ unset because MSVCRT works just fine without it, in fact TZ is just a way to break system settings here. The best solution I've figured out so far is caching my desired TZ value in some other variable in /etc/profile or similar (because the DST period part comes from a Ruby script), then set TZ with the cached value for each command I manage to figure out to be using MSYS runtime for local time (currently date and ls). > > Renalto -- > > While I've not tried putting a SETLOCAL / ENDLOCAL Pair in MSYS.BAT that might help. > > What has been working for me is to begin my $HOME/.profile with: > > unset TZ Thanks for the msys.bat tip, I plan to try it out later. But what do you mean unset TZ in bash works for you? What's your use case? Renalto -- I run a set of portable #!/bin/sh Data Conversion scripts on UNIX/Linux/WinXX. The scripts include 'the usual' UNIX Tools plus a few MinGW-Compiled Console C-Programs and a couple ActiveState Compiled Perl Apps. I use MSys to run the same scripts on Various WinXX Versions as I run on UNIX/Linux and I have the same scripts on 40-50 Machines 'out in the world'. The Windows System Environment includes a TZ Variable which is set by a Business BASIC App and when I 'leave it set' in the MSys Environment, the Dates reported by `ls` and `date` are unreliable. In addition, the dates reported by strftime(), systime() in gawk and localtime() perl report the same incorrect TimeZones I see in `ls` and `date`. Some Windows Systems show UTC while others show 'random' Time Zones. Adding an unset TZ to the top of my MSys ~/.profile fixes the dates for all my programs. HTH -- kjh( sorry about the formatting -- Outlook is a horrible email program -- I can't seem to 'take control' ) |