mirror of
https://github.com/ddworken/hishtory.git
synced 2025-02-23 05:51:08 +01: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
|
||||
|
||||
# Run before every command
|
||||
HISHTORY_START_TIME=`date +%s%N`
|
||||
HISHTORY_START_TIME=`date +%s`
|
||||
}
|
||||
trap "PreCommand" DEBUG
|
||||
|
||||
|
@ -8,7 +8,7 @@ function _hishtory_add() {
|
||||
# Runs after <ENTER>, but before the command is executed
|
||||
# $1 contains the command that was run
|
||||
_hishtory_command=$1
|
||||
_hishtory_start_time=`date +%s%N`
|
||||
_hishtory_start_time=`date +%s`
|
||||
}
|
||||
|
||||
function _hishtory_precmd() {
|
||||
|
@ -88,11 +88,11 @@ func BuildHistoryEntry(args []string) (*data.HistoryEntry, error) {
|
||||
entry.CurrentWorkingDirectory = cwd
|
||||
|
||||
// start time
|
||||
nanos, err := parseCrossPlatformInt(args[5])
|
||||
seconds, err := parseCrossPlatformInt(args[5])
|
||||
if err != nil {
|
||||
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
|
||||
entry.EndTime = time.Now()
|
||||
|
@ -9,7 +9,7 @@ function PreCommand() {
|
||||
unset HISHTORY_AT_PROMPT
|
||||
|
||||
# Run before every command
|
||||
HISHTORY_START_TIME=`date +%s%N`
|
||||
HISHTORY_START_TIME=`date +%s`
|
||||
}
|
||||
trap "PreCommand" DEBUG
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user