aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/utils.vim17
1 files changed, 14 insertions, 3 deletions
diff --git a/autoload/utils.vim b/autoload/utils.vim
index 9b4bb90..a004bd5 100644
--- a/autoload/utils.vim
+++ b/autoload/utils.vim
@@ -128,11 +128,22 @@ endfunction
" Output current time or unix timestamp in human-readable format.
function! utils#iso_time(timestamp) abort
- if a:timestamp
- return strftime('%Y-%m-%d %H:%M:%S%z', a:timestamp)
+ " Get current datetime
+ if !a:timestamp
+ return strftime('%Y-%m-%d %H:%M:%S%z')
endif
- return strftime('%Y-%m-%d %H:%M:%S%z')
+ " this timestamp in expressed in milliseconds
+ if len(a:timestamp) == 13
+ let l:timestamp = a:timestamp[:-4]
+ " this timestamp in expressed in microseconds
+ elseif len(a:timestamp) == 16
+ let l:timestamp = a:timestamp[:-7]
+ else
+ let l:timestamp = a:timestamp
+ endif
+ return strftime('%Y-%m-%d %H:%M:%S%z', l:timestamp)
+
endfunction
" Check if we are inside a Git repo.