This commit is contained in:
Alan Hamlett 2017-02-13 23:39:06 -08:00
parent 097688d664
commit 28a55238a6

View file

@ -6,7 +6,7 @@
" Website: https://wakatime.com/ " Website: https://wakatime.com/
" ============================================================================ " ============================================================================
let s:VERSION = '4.0.12' let s:VERSION = '4.0.13'
" Init {{{ " Init {{{
@ -67,7 +67,7 @@ let s:VERSION = '4.0.12'
function! s:StripWhitespace(str) function! s:StripWhitespace(str)
return substitute(a:str, '^\s*\(.\{-}\)\s*$', '\1', '') return substitute(a:str, '^\s*\(.\{-}\)\s*$', '\1', '')
endfunction endfunction
function! s:SetupConfigFile() function! s:SetupConfigFile()
if !s:config_file_already_setup if !s:config_file_already_setup
@ -151,7 +151,7 @@ let s:VERSION = '4.0.12'
call s:SetLastHeartbeat(a:time, a:time, file) call s:SetLastHeartbeat(a:time, a:time, file)
endif endif
endfunction endfunction
function! s:GetLastHeartbeat() function! s:GetLastHeartbeat()
if !s:last_heartbeat[0] || localtime() - s:last_heartbeat[0] > s:local_cache_expire if !s:last_heartbeat[0] || localtime() - s:last_heartbeat[0] > s:local_cache_expire
if !filereadable(s:data_file) if !filereadable(s:data_file)
@ -164,11 +164,11 @@ let s:VERSION = '4.0.12'
endif endif
return s:last_heartbeat return s:last_heartbeat
endfunction endfunction
function! s:SetLastHeartbeatLocally(time, last_update, file) function! s:SetLastHeartbeatLocally(time, last_update, file)
let s:last_heartbeat = [a:time, a:last_update, a:file] let s:last_heartbeat = [a:time, a:last_update, a:file]
endfunction endfunction
function! s:SetLastHeartbeat(time, last_update, file) function! s:SetLastHeartbeat(time, last_update, file)
call s:SetLastHeartbeatLocally(a:time, a:last_update, a:file) call s:SetLastHeartbeatLocally(a:time, a:last_update, a:file)
call writefile([substitute(printf('%d', a:time), ',', '.', ''), substitute(printf('%d', a:last_update), ',', '.', ''), a:file], s:data_file) call writefile([substitute(printf('%d', a:time), ',', '.', ''), substitute(printf('%d', a:last_update), ',', '.', ''), a:file], s:data_file)
@ -181,7 +181,7 @@ let s:VERSION = '4.0.12'
endif endif
return 0 return 0
endfunction endfunction
" }}} " }}}