Permalink
Browse files

Reliable detection of xolox#misc#timer#start() return values

  • Loading branch information...
1 parent 1e4f278 commit abac1c8b1f4fcd4c4350f34a35997cb3da7a4249 @xolox committed Jun 2, 2013
Showing with 10 additions and 9 deletions.
  1. +1 −1 README.md
  2. +7 −6 autoload/xolox/misc/timer.vim
  3. +2 −2 doc/misc.txt
View
@@ -39,7 +39,7 @@ that I haven't published yet.
<!-- Start of generated documentation -->
The documentation of the 43 functions below was extracted from
-15 Vim scripts on June 2, 2013 at 18:21.
+14 Vim scripts on June 2, 2013 at 20:24.
### Handling of special buffers
@@ -13,11 +13,12 @@ if !exists('g:timer_verbosity')
endif
let s:has_reltime = has('reltime')
+let s:unique_marker = 'xolox#misc#timer#value'
function! xolox#misc#timer#start() " {{{1
" Start a timer. This returns a list which can later be passed to
" `xolox#misc#timer#stop()`.
- return s:has_reltime ? reltime() : [localtime()]
+ return [s:unique_marker, s:has_reltime ? reltime() : localtime()]
endfunction
function! xolox#misc#timer#stop(...) " {{{1
@@ -46,15 +47,15 @@ function! xolox#misc#timer#force(...) " {{{1
endfunction
function! s:convert_value(value) " {{{1
- if type(a:value) != type([])
- return a:value
- else
+ if type(a:value) == type([]) && len(a:value) == 2 && a:value[0] == s:unique_marker
if s:has_reltime
- let ts = xolox#misc#str#trim(reltimestr(reltime(a:value)))
+ let ts = xolox#misc#str#trim(reltimestr(reltime(a:value[1])))
else
- let ts = localtime() - a:value[0]
+ let ts = localtime() - a:value[1]
endif
return xolox#misc#format#timestamp(ts)
+ else
+ return a:value
endif
endfunction
View
@@ -111,8 +111,8 @@ that I haven't published yet.
Start of generated documentation
-The documentation of the 43 functions below was extracted from 15 Vim scripts
-on June 2, 2013 at 18:21.
+The documentation of the 43 functions below was extracted from 14 Vim scripts
+on June 2, 2013 at 20:24.
-------------------------------------------------------------------------------
*misc-handling-of-special-buffers*

0 comments on commit abac1c8

Please sign in to comment.