2

I'm trying to get "dts" to echo the current local time in vim (cygwin under Windows 7) byt the output is GMT+1 instead of the localtime (GMT-7). My abbreviation works fine on other machines, but I can't get it to work on this one.

The abbreviation is:

dts <expr> strftime("%m.%d.%Y %H:%M:%S")
Result: 3/27/2012 9:53:03 PM

From the cygwin command line, TZ is set to America/Los_Angeles and the date command outputs the correct time. It's only when I try using strftime() under gvim that the timestamp is wrong. I tried adding %z to see the GMT offeset but the results are even more baffling:

:iab qwe strftime("%c (%z)")
Result: 3/27/2012 9:53:03 PM (ric)

I have been unable to figure out what "ric" means.

Logan
  • 141
  • 7
  • Pardon my ignorance, but what's `dts`? – Yanick Girouard Mar 28 '12 at 00:55
  • 1
    Sorry about that, dts is the name of the abbreviation. When I type "dts" vim will eval the expression strftime ("%m.%d.%Y %H:%M:%S") and print a timestamp (3/27/2012 9:53:03 PM). In the second example, I've created a second version mapped to the abbreviation "qwe". – Logan Mar 28 '12 at 18:29

1 Answers1

0

I have seen this as well with gvim 7.3.46 and cygwin 1.7.13.

I noticed that I did not have this problem with gvim 7.3.46 and cygwin 1.7.9.

I also noticed that the output of date was different in each case:

 (cygwin 1.7.9) Sun Apr 29 23:25:04 EDT 2012
 (cygwin 1.7.13) Sun, Apr 29, 2012 11:25:09 PM

I wonder if the addition of tzset in 1.7.10 has something to do with this.

  • my concerns about the difference in the outputs of `date` notwithstanding, the [solution](http://sourceware.org/ml/cygwin/2012-03/msg00048.html) appears to be to `unset TZ` before running `gvim` from within Cygwin. – smooth reggae Apr 30 '12 at 16:37