使用Emacs跟踪flexitime(&org-mode)

所以,在工作中,我们使用flexitime(弹性小时,弹性小时…)这是很好,但很难跟踪。 我正在使用组织模式来跟踪我的工作时间( org-clock-(out|in) ),但我想扩展到自动计算,如果我已经工作超过8小时(剩余时间应该是加到我的flexitime'账户')或更less(取决于我吃了多less午休时间等),我的弹性“账户”上的余额等等。

其他人使用Emacs吗?

我目前正在使用一个非常基本的设置来跟踪我的时间:

 (defun check-in () (interactive) (let (pbuf (current-buffer)) (find-file (convert-standard-filename "whatnot")) (goto-char (point-max)) (insert "\n") (org-insert-heading) (org-insert-time-stamp (current-time)) (org-clock-in) (save-buffer) (switch-to-buffer pbuf))) (defun check-out () (interactive) (let (pbuf (current-buffer)) (find-file (convert-standard-filename "whatnot")) (goto-char (point-max)) (org-clock-out) (save-buffer) (switch-to-buffer pbuf))) 

假设我正确地理解了你的问题,我一起砍了一个快速的解决scheme。 首先,如果您多次登入和注销,则应确保每天只创build一个大纲条目。 定义下面的函数来计算给定日子的加class时间。

 (defun compute-overtime (duration-string) "Computes overtime duration string for the given time DURATION-STRING." (let (minutes-in-a-workday work-minutes overtime-minutes) (defconst minutes-in-a-workday 480) (setq work-minutes (org-duration-string-to-minutes duration-string) overtime-minutes (- work-minutes minutes-in-a-workday)) (if (< overtime-minutes 0) (setq overtime-minutes 0)) (org-minutes-to-hh:mm-string overtime-minutes))) 

然后,在文件whatnot的时钟表公式中使用它。

 #+BEGIN: clocktable :maxlevel 1 :emphasize nil :scope file :formula "$3='(compute-overtime $2)::@2$3=string(\"Overtime\")" #+END: clocktable 

当你在时钟表上点击Cc Cc来重新生成它。

你可以通过加总使用另一个公式加总。 但是,我没有解决这个问题。