Time calculations in org
The following is exported from an org-mode text:
Late hours per month
It's the last day of the month, this is the time I usually leave at (based on the time I clocked in this morning)
clock in | work hours | clock out |
---|---|---|
07:30:00 | 8 | 15:30:00 |
However, I have saved some time from the 4 hours late allowance. Let's calculate that. Summing late hours for each day in the month
late hours |
---|
00:23:02 |
00:28:30 |
00:07:21 |
01:17:48 |
02:16:41 |
Finding the remaining time in hours (notice the remote table)
total allowed late hours | total late hours | remaining allowance |
---|---|---|
04:00:00 | 02:16:41 | 01:43:19 |
Taking the remaing from the monthly allowance:
leaving time | remaining allowance | updated leaving time |
---|---|---|
15:30:00 | 01:43:19 | 13:46:41 |
The following org-mode tables are used to calculate the values in the html tables below
#+NAME: leavingtime
| clock in | work hours | clock out |
|----------+------------+-----------|
| 07:30:00 | 8 | 15:30:00 |
#+TBLFM: $3=$1+$2*3600;T
#+NAME: latehours
| late hours |
|------------|
| 00:23:02 |
| 00:28:30 |
| 00:07:21 |
| 01:17:48 |
| |
| 02:16:41 |
#+TBLFM: @>=vsum(@I..@-1);T
#+NAME: remaininghours
| total allowed late hours | total late hours | remaining allowance |
|--------------------------+------------------+---------------------|
| 04:00:00 | 02:16:41 | 01:43:19 |
#+TBLFM: $2='(identity remote(latehours,@>$1))::$3=$1-$2;T
| leaving time | remaining allowance | updated leaving time |
|--------------+---------------------+----------------------|
| 15:30:00 | 01:43:19 | 13:46:41 |
#+TBLFM: $1='(identity remote(ltime,@2$4))::$2='(identity remote(remaininghours,@2$3))::$3=$1-$2;T