;;; timeclock.el --- mode for keeping track of how much you work
-;; Copyright (C) 1999-2014 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2015 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@gnu.org>
;; Created: 25 Mar 1999
;;
;; (add-hook 'kill-emacs-query-functions 'timeclock-query-out)
-;; NOTE: If you change your .timelog file without using timeclock's
+;; NOTE: If you change your timelog file without using timeclock's
;; functions, or if you change the value of any of timeclock's
;; customizable variables, you should run the command
;; `timeclock-reread-log'. This will recompute any discrepancies in
(defcustom timeclock-file (locate-user-emacs-file "timelog" ".timelog")
"The file used to store timeclock data in."
+ :version "24.4" ; added locate-user-emacs-file
:type 'file
:group 'timeclock)
(cancel-timer timeclock-update-timer)
(setq timeclock-update-timer nil))))
-(defsubst timeclock-time-to-date (time)
+(defsubst timeclock-time-to-date (&optional time)
"Convert the TIME value to a textual date string."
(format-time-string "%Y/%m/%d" time))
(unless (and timeclock-last-event
(equal (timeclock-time-to-date
(cadr timeclock-last-event))
- (timeclock-time-to-date (current-time))))
+ (timeclock-time-to-date)))
(let ((workday (or (and (numberp arg) arg)
(and arg 0)
(and timeclock-get-workday-function
If TODAY-ONLY is non-nil, the value returned will be relative only to
the time worked today, and not to past time."
(timeclock-seconds-to-time
- (- (timeclock-time-to-seconds (current-time))
+ (- (timeclock-time-to-seconds)
(let ((discrep (timeclock-find-discrep)))
(if discrep
(if today-only
(if timeclock-use-elapsed
(timeclock-workday-elapsed)
(timeclock-workday-remaining (not timeclock-relative))))
- (last-in (equal (car timeclock-last-event) "i")))
+ (last-in (equal (car timeclock-last-event) "i"))
+ (todays-date (timeclock-time-to-date)))
(when (and (< remainder 0)
(not (and timeclock-day-over
- (equal timeclock-day-over
- (timeclock-time-to-date
- (current-time))))))
- (setq timeclock-day-over
- (timeclock-time-to-date (current-time)))
+ (equal timeclock-day-over todays-date))))
+ (setq timeclock-day-over todays-date)
(run-hooks 'timeclock-day-over-hook))
(setq timeclock-mode-string
(propertize
This is only provided for coherency when used by
`timeclock-discrepancy'."
(if (equal (car timeclock-last-event) "i")
- (- (timeclock-time-to-seconds (or moment (current-time)))
- (timeclock-time-to-seconds
- (cadr timeclock-last-event)))
+ (- (timeclock-time-to-seconds moment)
+ (timeclock-time-to-seconds (cadr timeclock-last-event)))
timeclock-last-period))
(defsubst timeclock-entry-length (entry)
(+ timeclock-last-period timeclock-elapsed)))))
(setq timeclock-last-event event
timeclock-last-event-workday
- (if (equal (timeclock-time-to-date now) last-date-limited)
+ (if (equal todays-date last-date-limited)
last-date-seconds
timeclock-workday))
(forward-line))
(defun timeclock-day-base (&optional time)
"Given a time within a day, return 0:0:0 within that day.
If optional argument TIME is non-nil, use that instead of the current time."
- (let ((decoded (decode-time (or time (current-time)))))
+ (let ((decoded (decode-time time)))
(setcar (nthcdr 0 decoded) 0)
(setcar (nthcdr 1 decoded) 0)
(setcar (nthcdr 2 decoded) 0)