Use command date +%s%3N in non OS X systems to get the epoch in ms. #252

* Define __fisher_get_epoch_in_ms on fisher.fish load and select
  command date if the user for systems other than OS X.
This commit is contained in:
detailyang 2016-05-05 12:16:23 +08:00 committed by Jorge Bucaran
parent 11d4b278c5
commit 08ea67ddc3

View file

@ -1735,12 +1735,23 @@ function __fisher_get_key
end
function __fisher_get_epoch_in_ms -a elapsed
if test -z "$elapsed"
set elapsed 0
end
switch (command uname)
case Darwin
function __fisher_get_epoch_in_ms -a elapsed
if test -z "$elapsed"
set elapsed 0
end
perl -MTime::HiRes -e 'printf("%.0f\n", (Time::HiRes::time() * 1000) - '$elapsed')'
perl -MTime::HiRes -e 'printf("%.0f\n", (Time::HiRes::time() * 1000) - '$elapsed')'
end
case '*'
function __fisher_get_epoch_in_ms -a elapsed
if test -z "$elapsed"
set elapsed 0
end
math (command date +%s%3N) - $elapsed
end
end