mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-06 05:06:44 +02:00
Swap to getting date in seconds since BSD date doesn't support nanos
This commit is contained in:
parent
ca1987a9ab
commit
76f12ab64a
@ -8,7 +8,7 @@ function PreCommand() {
|
|||||||
unset HISHTORY_AT_PROMPT
|
unset HISHTORY_AT_PROMPT
|
||||||
|
|
||||||
# Run before every command
|
# Run before every command
|
||||||
HISHTORY_START_TIME=`date +%s%N`
|
HISHTORY_START_TIME=`date +%s`
|
||||||
}
|
}
|
||||||
trap "PreCommand" DEBUG
|
trap "PreCommand" DEBUG
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ function _hishtory_add() {
|
|||||||
# Runs after <ENTER>, but before the command is executed
|
# Runs after <ENTER>, but before the command is executed
|
||||||
# $1 contains the command that was run
|
# $1 contains the command that was run
|
||||||
_hishtory_command=$1
|
_hishtory_command=$1
|
||||||
_hishtory_start_time=`date +%s%N`
|
_hishtory_start_time=`date +%s`
|
||||||
}
|
}
|
||||||
|
|
||||||
function _hishtory_precmd() {
|
function _hishtory_precmd() {
|
||||||
|
@ -88,11 +88,11 @@ func BuildHistoryEntry(args []string) (*data.HistoryEntry, error) {
|
|||||||
entry.CurrentWorkingDirectory = cwd
|
entry.CurrentWorkingDirectory = cwd
|
||||||
|
|
||||||
// start time
|
// start time
|
||||||
nanos, err := parseCrossPlatformInt(args[5])
|
seconds, err := parseCrossPlatformInt(args[5])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to parse start time %s as int: %v", args[5], err)
|
return nil, fmt.Errorf("failed to parse start time %s as int: %v", args[5], err)
|
||||||
}
|
}
|
||||||
entry.StartTime = time.Unix(0, nanos)
|
entry.StartTime = time.Unix(seconds, 0)
|
||||||
|
|
||||||
// end time
|
// end time
|
||||||
entry.EndTime = time.Now()
|
entry.EndTime = time.Now()
|
||||||
|
@ -9,7 +9,7 @@ function PreCommand() {
|
|||||||
unset HISHTORY_AT_PROMPT
|
unset HISHTORY_AT_PROMPT
|
||||||
|
|
||||||
# Run before every command
|
# Run before every command
|
||||||
HISHTORY_START_TIME=`date +%s%N`
|
HISHTORY_START_TIME=`date +%s`
|
||||||
}
|
}
|
||||||
trap "PreCommand" DEBUG
|
trap "PreCommand" DEBUG
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user