[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/calendar/timeclock.el
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/calendar/timeclock.el |
Date: |
Thu, 12 Jun 2003 13:28:48 -0400 |
Index: emacs/lisp/calendar/timeclock.el
diff -c emacs/lisp/calendar/timeclock.el:1.24
emacs/lisp/calendar/timeclock.el:1.25
*** emacs/lisp/calendar/timeclock.el:1.24 Tue May 27 14:36:40 2003
--- emacs/lisp/calendar/timeclock.el Thu Jun 12 13:28:48 2003
***************
*** 144,149 ****
--- 144,153 ----
(defvar timeclock-update-timer nil
"The timer used to update `timeclock-mode-string'.")
+ ;; For byte-compiler.
+ (defvar display-time-hook)
+ (defvar timeclock-modeline-display)
+
(defcustom timeclock-use-display-time t
"*If non-nil, use `display-time-hook' for doing modeline updates.
The advantage to this is that it means one less timer has to be set
***************
*** 321,326 ****
--- 325,334 ----
:group 'timeclock
:require 'timeclock)
+ (defsubst timeclock-time-to-date (time)
+ "Convert the TIME value to a textual date string."
+ (format-time-string "%Y/%m/%d" time))
+
;;;###autoload
(defun timeclock-in (&optional arg project find-project)
"Clock in, recording the current time moment in the timelog.
***************
*** 392,404 ****
(if arg
(run-hooks 'timeclock-done-hook))))
;;;###autoload
(defun timeclock-status-string (&optional show-seconds today-only)
"Report the overall timeclock status at the present moment."
(interactive "P")
! (let* ((remainder (timeclock-workday-remaining))
! (last-in (equal (car timeclock-last-event) "i"))
! status)
(setq status
(format "Currently %s since %s (%s), %s %s, leave at %s"
(if last-in "IN" "OUT")
--- 400,425 ----
(if arg
(run-hooks 'timeclock-done-hook))))
+ (defsubst timeclock-workday-remaining (&optional today-only)
+ "Return the number of seconds until the workday is complete.
+ The amount returned is relative to the value of `timeclock-workday'.
+ If TODAY-ONLY is non-nil, the value returned will be relative only to
+ the time worked today, and not to past time. This argument only makes
+ a difference if `timeclock-relative' is non-nil."
+ (let ((discrep (timeclock-find-discrep)))
+ (if discrep
+ (if today-only
+ (- (cadr discrep))
+ (- (car discrep)))
+ 0.0)))
+
;;;###autoload
(defun timeclock-status-string (&optional show-seconds today-only)
"Report the overall timeclock status at the present moment."
(interactive "P")
! (let ((remainder (timeclock-workday-remaining))
! (last-in (equal (car timeclock-last-event) "i"))
! status)
(setq status
(format "Currently %s since %s (%s), %s %s, leave at %s"
(if last-in "IN" "OUT")
***************
*** 431,439 ****
(defun timeclock-query-out ()
"Ask the user before clocking out.
This is a useful function for adding to `kill-emacs-query-functions'."
! (if (and (equal (car timeclock-last-event) "i")
! (y-or-n-p "You're currently clocking time, clock out? "))
! (timeclock-out)))
;;;###autoload
(defun timeclock-reread-log ()
--- 452,462 ----
(defun timeclock-query-out ()
"Ask the user before clocking out.
This is a useful function for adding to `kill-emacs-query-functions'."
! (and (equal (car timeclock-last-event) "i")
! (y-or-n-p "You're currently clocking time, clock out? ")
! (timeclock-out))
! ;; Unconditionally return t for `kill-emacs-query-functions'.
! t)
;;;###autoload
(defun timeclock-reread-log ()
***************
*** 465,483 ****
(truncate (/ (abs seconds) 60 60))
(% (truncate (/ (abs seconds) 60)) 60))))
- (defsubst timeclock-workday-remaining (&optional today-only)
- "Return the number of seconds until the workday is complete.
- The amount returned is relative to the value of `timeclock-workday'.
- If TODAY-ONLY is non-nil, the value returned will be relative only to
- the time worked today, and not to past time. This argument only makes
- a difference if `timeclock-relative' is non-nil."
- (let ((discrep (timeclock-find-discrep)))
- (if discrep
- (if today-only
- (- (cadr discrep))
- (- (car discrep)))
- 0.0)))
-
(defsubst timeclock-currently-in-p ()
"Return non-nil if the user is currently clocked in."
(equal (car timeclock-last-event) "i"))
--- 488,493 ----
***************
*** 520,525 ****
--- 530,547 ----
(message string)
string)))
+ (defsubst timeclock-time-to-seconds (time)
+ "Convert TIME to a floating point number."
+ (+ (* (car time) 65536.0)
+ (cadr time)
+ (/ (or (car (cdr (cdr time))) 0) 1000000.0)))
+
+ (defsubst timeclock-seconds-to-time (seconds)
+ "Convert SECONDS (a floating point number) to an Emacs time structure."
+ (list (floor seconds 65536)
+ (floor (mod seconds 65536))
+ (floor (* (- seconds (ffloor seconds)) 1000000))))
+
(defsubst timeclock-when-to-leave (&optional today-only)
"Return a time value representing at when the workday ends today.
If TODAY-ONLY is non-nil, the value returned will be relative only to
***************
*** 656,677 ****
(sec (string-to-number (match-string 7)))
(project (match-string 8)))
(list code (encode-time sec min hour mday mon year) project))))
-
- (defsubst timeclock-time-to-seconds (time)
- "Convert TIME to a floating point number."
- (+ (* (car time) 65536.0)
- (cadr time)
- (/ (or (car (cdr (cdr time))) 0) 1000000.0)))
-
- (defsubst timeclock-seconds-to-time (seconds)
- "Convert SECONDS (a floating point number) to an Emacs time structure."
- (list (floor seconds 65536)
- (floor (mod seconds 65536))
- (floor (* (- seconds (ffloor seconds)) 1000000))))
-
- (defsubst timeclock-time-to-date (time)
- "Convert the TIME value to a textual date string."
- (format-time-string "%Y/%m/%d" time))
(defun timeclock-last-period (&optional moment)
"Return the value of the last event period.
--- 678,683 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/lisp/calendar/timeclock.el,
Glenn Morris <=