;;; timeclock.el --- mode for keeping track of how much you work
-;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-;; 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2011 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@gnu.org>
;; Created: 25 Mar 1999
60 60.0) 60))))))
(timeclock-log "i" (or project
(and timeclock-get-project-function
- (or find-project (interactive-p))
+ (or find-project
+ (called-interactively-p 'interactive))
(funcall timeclock-get-project-function))))
(run-hooks 'timeclock-in-hook)))
(if arg "O" "o")
(or reason
(and timeclock-get-reason-function
- (or find-reason (interactive-p))
+ (or find-reason (called-interactively-p 'interactive))
(funcall timeclock-get-reason-function))))
(run-hooks 'timeclock-out-hook)
(if arg
(if (> remainder 0)
"remaining" "over")
(timeclock-when-to-leave-string show-seconds today-only)))
- (if (interactive-p)
+ (if (called-interactively-p 'interactive)
(message "%s" status)
status)))
working on."
(interactive "P")
(timeclock-out arg)
- (timeclock-in nil project (interactive-p)))
+ (timeclock-in nil project (called-interactively-p 'interactive)))
;;;###autoload
(defun timeclock-query-out ()
(let ((string (timeclock-seconds-to-string
(timeclock-workday-remaining today-only)
show-seconds t)))
- (if (interactive-p)
+ (if (called-interactively-p 'interactive)
(message "%s" string)
string)))
(interactive)
(let ((string (timeclock-seconds-to-string (timeclock-workday-elapsed)
show-seconds)))
- (if (interactive-p)
+ (if (called-interactively-p 'interactive)
(message "%s" string)
string)))
-(defsubst timeclock-time-to-seconds (time)
- "Convert TIME to a floating point number."
- (+ (* (car time) 65536.0)
- (cadr time)
- (/ (or (nth 2 time) 0) 1000000.0)))
+(defalias 'timeclock-time-to-seconds (if (fboundp 'float-time) 'float-time
+ 'time-to-seconds))
-(defsubst timeclock-seconds-to-time (seconds)
- "Convert SECONDS (a floating point number) to an Emacs time structure."
- (list (floor seconds 65536)
- (floor (mod seconds 65536))
- (floor (* (- seconds (ffloor seconds)) 1000000))))
+(defalias 'timeclock-seconds-to-time 'seconds-to-time)
;; Should today-only be removed in favour of timeclock-relative? - gm
(defsubst timeclock-when-to-leave (&optional today-only)
(if show-seconds
(format-time-string "%-I:%M:%S %p" then)
(format-time-string "%-I:%M %p" then))))
- (if (interactive-p)
+ (if (called-interactively-p 'interactive)
(message "%s" string)
string)))
timeclock-current-debt LOG-DATA
See the documentation for the given function if more info is needed."
- (let* ((log-data (list 0.0 nil nil))
- (now (current-time))
- (todays-date (timeclock-time-to-date now))
- last-date-limited last-date-seconds last-date
- (line 0) last beg day entry event)
+ (let ((log-data (list 0.0 nil nil))
+ (now (current-time))
+ last-date-limited last-date-seconds last-date
+ (line 0) last beg day entry event)
(with-temp-buffer
(insert-file-contents (or filename timeclock-file))
(when recent-only
(let* ((now (current-time))
(todays-date (timeclock-time-to-date now))
(first t) (accum 0) (elapsed 0)
- event beg last-date avg
+ event beg last-date
last-date-limited last-date-seconds)
(unless timeclock-discrepancy
(when (file-readable-p timeclock-file)
(if (file-readable-p timeclock-file)
(timeclock-reread-log))
-;; arch-tag: a0be3377-deb6-44ec-b9a2-a7be28436a40
;;; timeclock.el ends here