Commits

Cameron Simpson  committed d372636

dlog: only use nonportable "date -d" if $DLOG_WHEN is set

  • Participants
  • Parent commits 83f6ce3

Comments (0)

Files changed (1)

 [ -t 2 ] && echo=eecho
 
 : ${LOGDIR:=$HOME/var/log}
-: ${DLOG_WHEN:=`date`}
+
+when=${DLOG_WHEN:-}
 
 [ -t 0 ] && exec </dev/null
 
 case "$logname" in /*) ;; *) logname=$LOGDIR/$logname ;; esac
 [ $# = 0 ] && exec pageif cat "$logname"
 
-ts=`date -d "$DLOG_WHEN" '+%Y-%m-%d-%H:%M:%S'`
+if [ -n "$when" ]
+then  ts=`date -d "$DLOG_WHEN" '+%Y-%m-%d-%H:%M:%S'`
+else  ts=`date '+%Y-%m-%d-%H:%M:%S'`
+fi
 echo "$ts $*" >>"$logname"
 exec buglog -B dlog "$*"