Commit b7edbe64 authored by Michael Ott's avatar Michael Ott
Browse files

Added new commandline switch -l to provide human-readable timestamps for the x-axis

parent e1017927
......@@ -7,6 +7,7 @@ INFILETMP=0
ZEROOFFSET=0
SMOOTH=""
CLEANTEMP=1
LOCALTIME=0
if [ "$#" -ge "1" ]; then
while [ "${1:0:1}" == "-" ]; do
......@@ -19,6 +20,8 @@ if [ "$#" -ge "1" ]; then
;;
t) CLEANTEMP=0
;;
l) LOCALTIME=1
;;
*) echo "Unknown Parameter $1"
;;
esac
......@@ -38,6 +41,7 @@ if [ -t 0 ]; then
echo " -c Smooth graph with csplines"
echo " -z Start y-axis at 0"
echo " -t Don't clean temporary files"
echo " -l Print timestamps as local time"
exit
fi
INFILE=$1
......@@ -91,16 +95,19 @@ while read -r i; do
done <<< "$S"
# Find the smallest time stamp
U="2999999999999999999"
while read -r i; do
T=`head -n1 $TMP/${i}.dat | awk -F "," '{print $2}'`
echo "$T" | grep ":" > /dev/null
echo "$TMP/${i}.dat starts at: $T"
if [ "$T" -lt "$U" ]; then
U="$T"
fi
done <<< "$S"
echo "Plot starts at: $U"
U=0
if [ "$LOCALTIME" != "1" ]; then
U="2999999999999999999"
while read -r i; do
T=`head -n1 $TMP/${i}.dat | awk -F "," '{print $2}'`
echo "$T" | grep ":" > /dev/null
echo "$TMP/${i}.dat starts at: $T"
if [ "$T" -lt "$U" ]; then
U="$T"
fi
done <<< "$S"
echo "Plot starts at: $U"
fi
# Write new data files with updated time stamps
while read -r i; do
......@@ -130,6 +137,15 @@ set output '$OUTFILE'
EOF
fi
if [ "$LOCALTIME" == "1" ]; then
cat >> $TMP/plot.gplt << EOF
set xdata time
set timefmt "%s"
set format x "%H:%M:%S\n%d/%m/%Y"
EOF
fi
if [ "$ZEROOFFSET" == "1" ]; then
echo "set yrange [0:]" >> $TMP/plot.gplt
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment