Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

60 lines (45 sloc) 1.939 kb
;;; task-timer.el --- Simple task timer package.
;; Author: Jeremy Cowgar <jeremy@cowgar.com>
;; Keywords: timer task-timer
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; This package allows you to time an activity. Start the timer then
;; when stoppig the timer it will report the amount of time elapsed
;;; Requirements:
;;; Installation:
;; Add below code in your .emacs
;;
;; (require 'task-timer)
;;; Usage:
;;
;; 1. Interactively call (task-timer-start) to start the timer
;; 2. Interactively call (task-timer-status) to query as to how
;; long the timer has been running. There is no real need to
;; stop the timer, to restart the timer just start it again.
;;
;; Suggested binding:
;; (define-key global-map "\C-ctb" 'task-timer-begin)
;; (define-key global-map "\C-cts" 'task-timer-status)
;;
(defun task-timer-begin ()
(interactive)
(setq task-timer-started (current-time)))
(defun task-timer-status ()
(interactive)
(let* ((remaining-time (decode-time (time-subtract (current-time) task-timer-started)))
(remaining-seconds (nth 0 remaining-time))
(remaining-minutes (nth 1 remaining-time)))
(message "%d min %d sec" remaining-minutes remaining-seconds)))
(provide 'task-timer)
;;; task-timer ends here
Jump to Line
Something went wrong with that request. Please try again.