changeset 46350:9cead6e97a53

(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.
author Glenn Morris <rgm@gnu.org>
date Sat, 13 Jul 2002 18:51:28 +0000
parents 4f0aafa6b3bf
children 44a2f4703942
files lisp/calendar/timeclock.el
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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))))))