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 in summer, 开发者_JAVA技巧its timezone offset is currently +2 (UTC+2).
Portability concerns exclude using external programs or non native scripting engines (Perl, Python, Ruby...).
:echo strftime("%z")
is as portable as the %z
format specifier is.
精彩评论