# HG changeset patch # User Glenn Morris # Date 1026586288 0 # Node ID 9cead6e97a53a939a5c2e9016ab28bb4fee03cf3 # Parent 4f0aafa6b3bf58191efe1da26e9b1a1d7882666f (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. diff -r 4f0aafa6b3bf -r 9cead6e97a53 lisp/calendar/timeclock.el --- a/lisp/calendar/timeclock.el Sat Jul 13 18:08:11 2002 +0000 +++ b/lisp/calendar/timeclock.el Sat Jul 13 18:51:28 2002 +0000 @@ -338,9 +338,11 @@ (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 @@ (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))))))