From 4105dd524e297345ea8cd9f0ccd01eb263165f03 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 13 Jul 2002 18:56:04 +0000 Subject: [PATCH] (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. --- lisp/ChangeLog | 5 +++++ lisp/calendar/timeclock.el | 10 ++++++---- 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 + + * 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 * 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)))))) -- 2.11.4.GIT