I would like to write an Emacs lisp function, that I can bind to a key shortcut. It will read in the two previous time entries in the format HHMM from the buffer and spit out the difference between them in the format 0.75, that is 45 minutes.
This is the format it should operate with.
1400 Enable ftp access for Sarah 1430 .5
find the previous instance of HHMM in this buffer, occurs at the beginning of a line, and then find the one before that
determine the difference between the two times
output in hours with decimal fractions instead of minutes
$end-time = (search back from pointer for previous instance of HHMM) $begin-time = (search for second previous instance of HHMM) $end-hour = $end-time[0,1] $end-minute = $end-time[2,3] $begin-hour = $begin-time[0,1] $begin-minute = $begin-time[2,3] $total-hours = $end-hour - $begin-hour $total-minutes = $end-minutes - $begin-minutes return $total-hours + ($total-minutes * 0.01666666667)