tpope / vim-speeddating

speeddating.vim: use CTRL-A/CTRL-X to increment dates, times, and more
http://www.vim.org/scripts/script.php?script_id=2120
971 stars 40 forks source link

'China Standard Time' time zone not supported? #15

Closed bohrshaw closed 10 years ago

bohrshaw commented 10 years ago

I got a wrong local time even with these manual settings:

   let g:speeddating_zone = 'CST'
   let g:speeddating_zone_dst = 'CST'
tpope commented 10 years ago

Should work fine. What are you getting and what are you expecting?

bohrshaw commented 10 years ago

d<C-X> would change a time text to '14:18:48', yet the actual current local time is '15:34:??' which matches the output of strftime('%H:%M:%S').

bohrshaw commented 10 years ago

d<C-X> would change the current date Apr 02 15:42:58 2014 to Jan 1 14:26:44 2014.

tpope commented 10 years ago

Whoa, that's not even off by a whole number of hours.

Does d<C-A> give the correct UTC time?

Open up autoload/speeddating.vim and at the very bottom add

let g:offset = s:offset
let g:offset_dst = s:offset_dst

What's the value of :echo g:offset and :echo g:offset_dst when you do that?

bohrshaw commented 10 years ago

d<C-A> does give the correct UTC time.

Both g:offset and g:offset_dst are 480.

tpope commented 10 years ago

Those look fine, assuming UTC+8. What about :let g:localtime = s:localtime()? Should get a big old dictionary.

bohrshaw commented 10 years ago

{'b': 1, 's': 4, 'd': 1, 'h': 8, 'y': 1970, 'k': 633, 'm': 15, 'o': 480}

tpope commented 10 years ago

Are you on Windows?

bohrshaw commented 10 years ago

Yes.