summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2002-07-13 18:56:04 +0000
committerGlenn Morris <rgm@gnu.org>2002-07-13 18:56:04 +0000
commit4105dd524e297345ea8cd9f0ccd01eb263165f03 (patch)
tree8ef3c46bef8f05adc25f1e63db637839a8364915
parent65399e8313a1cb1e659259bda2244400f305050a (diff)
downloademacs-4105dd524e297345ea8cd9f0ccd01eb263165f03.tar.gz
emacs-4105dd524e297345ea8cd9f0ccd01eb263165f03.tar.bz2
emacs-4105dd524e297345ea8cd9f0ccd01eb263165f03.zip
(timeclock-in): Run the new day section if, after rereading the log file,
timeclock-last-event is nil, indicating no log file exists yet. Take account of the fact that timeclock-discrepancy will be nil in that case.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/calendar/timeclock.el10
2 files changed, 11 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 707dc9dc122..f3e66eb7df3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2002-07-13 Glenn Morris <gmorris@ast.cam.ac.uk>
+
+ * calendar/timeclock.el (timeclock-in): Handle the case where no
+ log file exists (ie the very first call).
+
2002-07-13 Kai Gro,b_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
* net/ange-ftp.el: Do not hook into file-name-handler-alist, this
diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el
index 21a931297e8..db679b8d55e 100644
--- a/lisp/calendar/timeclock.el
+++ b/lisp/calendar/timeclock.el
@@ -338,9 +338,11 @@ discover the name of the project."
(error "You've already clocked in!")
(unless timeclock-last-event
(timeclock-reread-log))
- (unless (equal (timeclock-time-to-date
- (cadr timeclock-last-event))
- (timeclock-time-to-date (current-time)))
+ ;; Either no log file, or day has rolled over.
+ (unless (and timeclock-last-event
+ (equal (timeclock-time-to-date
+ (cadr timeclock-last-event))
+ (timeclock-time-to-date (current-time))))
(let ((workday (or (and (numberp arg) arg)
(and arg 0)
(and timeclock-get-workday-function
@@ -349,7 +351,7 @@ discover the name of the project."
(run-hooks 'timeclock-first-in-hook)
;; settle the discrepancy for the new day
(setq timeclock-discrepancy
- (- timeclock-discrepancy workday))
+ (- (or timeclock-discrepancy 0) workday))
(if (not (= workday timeclock-workday))
(timeclock-log "h" (and (numberp arg)
(number-to-string arg))))))