views:

30

answers:

1

I would like to get the timezone offset of the user environment in a Vim script and that must be portable (Unix/linux/MacOSX, Windows).

For example, if the user is in Paris, its timezone offset is currently +2 (UTC+2).

Portability concerns exclude using external programs or non native scripting engines (Perl, Python, Ruby...).

A: 

:echo strftime("%z") is as portable as the %z format specifier is.

jamessan
That is the reason why I'm asking the question: 1. '%z' is not portable at all 2. on Windows '%z' gives a timezone name, not an offset
dolmen
@dolmen: If OS doesn't supply the information using the standard functions, the VIM is built upon, then you are likely out of luck. VIM isn't programming environment, it is a text editor.
Dummy00001