don't recalculate now when setting last update time

This commit is contained in:
Alan Hamlett 2013-07-10 00:55:42 -07:00
parent 02ad6aa5ce
commit 955e078e2f

View file

@ -91,7 +91,7 @@ let s:VERSION = '0.2.1'
if a:endtime > 1 && float2nr(round(time)) < float2nr(round(a:endtime)) if a:endtime > 1 && float2nr(round(time)) < float2nr(round(a:endtime))
let time = a:endtime let time = a:endtime
endif endif
call s:SetLastAction(time, targetFile) call s:SetLastAction(time, time, targetFile)
endif endif
endfunction endfunction
@ -106,9 +106,9 @@ let s:VERSION = '0.2.1'
return [str2float(last[0]), str2float(last[1]), last[2]] return [str2float(last[0]), str2float(last[1]), last[2]]
endfunction endfunction
function! s:SetLastAction(time, targetFile) function! s:SetLastAction(time, last_update, targetFile)
let s:fresh = 0 let s:fresh = 0
call writefile([printf('%f', a:time), printf('%f', s:GetCurrentTime()), a:targetFile], expand("$HOME/.wakatime.data")) call writefile([printf('%f', a:time), printf('%f', a:last_update), a:targetFile], expand("$HOME/.wakatime.data"))
endfunction endfunction
function! s:GetChar() function! s:GetChar()
@ -181,8 +181,8 @@ let s:VERSION = '0.2.1'
call s:Api(targetFile, now, last[0], 0, last) call s:Api(targetFile, now, last[0], 0, last)
endif endif
else else
if now - last[1] > 5: if now - last[1] > 5
call s:SetLastAction(last[0], targetFile) call s:SetLastAction(last[0], now, targetFile)
endif endif
endif endif
endfunction endfunction