From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: time values Date: Sat, 10 Jul 2004 19:33:21 -0500 (CDT) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200407110033.i6B0XLF08165@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1089506179 30286 80.91.224.253 (11 Jul 2004 00:36:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 11 Jul 2004 00:36:19 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun Jul 11 02:36:10 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BjSKA-00027P-00 for ; Sun, 11 Jul 2004 02:36:10 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BjSK9-00051z-00 for ; Sun, 11 Jul 2004 02:36:10 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BjSMO-0005JC-Er for emacs-devel@quimby.gnus.org; Sat, 10 Jul 2004 20:38:28 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BjSMH-0005J6-AN for emacs-devel@gnu.org; Sat, 10 Jul 2004 20:38:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BjSMD-0005Iu-JS for emacs-devel@gnu.org; Sat, 10 Jul 2004 20:38:21 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BjSMD-0005Ir-GH for emacs-devel@gnu.org; Sat, 10 Jul 2004 20:38:17 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BjSJw-0004MD-51 for emacs-devel@gnu.org; Sat, 10 Jul 2004 20:35:56 -0400 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id i6B0ZtuE011568 for ; Sat, 10 Jul 2004 19:35:55 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.6+Sun/8.11.6) id i6B0XLF08165; Sat, 10 Jul 2004 19:33:21 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:25569 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:25569 At Richard's request, I plan to soon change the return values of `visited-file-modtime' and `calendar-time-from-absolute' to the form (HIGH LOW) instead of (HIGH . LOW). Grepping shows that these are the last two functions that still return time values in this obsolete form. The return value of `visited-file-modtime' is also inconsistent with that of `file-attributes'. The change to `visited-file-modtime' requires supporting changes in dired.el and tramp.el. I do not know how tramp.el has to be handled since there is also a standalone version. I do not believe that changes in `lisp/gnus/nnfolder.el' or `lisp/fast-lock.el' are needed, but I use neither, so I do not feel 100% confident about that. Anyway, any problems I missed should be easy to correct by simple changes like replacing cdr by cadr or the like. Diffs: ===File ~/fileio.c-diff===================================== *** fileio.c 04 Jul 2004 21:04:39 -0500 1.506 --- fileio.c 10 Jul 2004 09:18:18 -0500 *************** *** 5628,5640 **** DEFUN ("visited-file-modtime", Fvisited_file_modtime, Svisited_file_modtime, 0, 0, 0, doc: /* Return the current buffer's recorded visited file modification time. ! The value is a list of the form (HIGH . LOW), like the time values that `file-attributes' returns. If the current buffer has no recorded file modification time, this function returns 0. See Info node `(elisp)Modification Time' for more details. */) () { ! return long_to_cons ((unsigned long) current_buffer->modtime); } DEFUN ("set-visited-file-modtime", Fset_visited_file_modtime, --- 5628,5644 ---- DEFUN ("visited-file-modtime", Fvisited_file_modtime, Svisited_file_modtime, 0, 0, 0, doc: /* Return the current buffer's recorded visited file modification time. ! The value is a list of the form (HIGH LOW), like the time values that `file-attributes' returns. If the current buffer has no recorded file modification time, this function returns 0. See Info node `(elisp)Modification Time' for more details. */) () { ! Lisp_Object tcons; ! tcons = long_to_cons ((unsigned long) current_buffer->modtime); ! if (CONSP (tcons)) ! return list2 (XCAR (tcons), XCDR (tcons)); ! return tcons; } DEFUN ("set-visited-file-modtime", Fset_visited_file_modtime, ============================================================ ===File ~/cal-dst.el-diff=================================== *** cal-dst.el 02 Sep 2003 07:40:04 -0500 1.20 --- cal-dst.el 09 Jul 2004 20:37:09 -0500 *************** *** 70,83 **** (defun calendar-time-from-absolute (abs-date s) "Time of absolute date ABS-DATE, S seconds after midnight. ! Returns the pair (HIGH . LOW) where HIGH and LOW are the high and low 16 bits, respectively, of the number of seconds 1970-01-01 00:00:00 UTC, ignoring leap seconds, that is the equivalent moment to S seconds after midnight UTC on absolute date ABS-DATE." (let* ((a (- abs-date calendar-system-time-basis)) (u (+ (* 163 (mod a 512)) (floor s 128)))) ;; Overflow is a terrible thing! ! (cons ;; floor((60*60*24*a + s) / 2^16) (+ a (* 163 (floor a 512)) (floor u 512)) ;; (60*60*24*a + s) mod 2^16 --- 70,83 ---- (defun calendar-time-from-absolute (abs-date s) "Time of absolute date ABS-DATE, S seconds after midnight. ! Returns the list (HIGH LOW) where HIGH and LOW are the high and low 16 bits, respectively, of the number of seconds 1970-01-01 00:00:00 UTC, ignoring leap seconds, that is the equivalent moment to S seconds after midnight UTC on absolute date ABS-DATE." (let* ((a (- abs-date calendar-system-time-basis)) (u (+ (* 163 (mod a 512)) (floor s 128)))) ;; Overflow is a terrible thing! ! (list ;; floor((60*60*24*a + s) / 2^16) (+ a (* 163 (floor a 512)) (floor u 512)) ;; (60*60*24*a + s) mod 2^16 ============================================================ ===File ~/dired.el-diff===================================== *** dired.el 11 Jun 2004 16:28:02 -0500 1.291 --- dired.el 09 Jul 2004 22:00:40 -0500 *************** *** 620,627 **** (modtime (visited-file-modtime))) (or (eq modtime 0) (not (eq (car attributes) t)) ! (and (= (car (nth 5 attributes)) (car modtime)) ! (= (nth 1 (nth 5 attributes)) (cdr modtime))))))) (defun dired-buffer-stale-p (&optional noconfirm) "Return non-nil if current dired buffer needs updating. --- 620,626 ---- (modtime (visited-file-modtime))) (or (eq modtime 0) (not (eq (car attributes) t)) ! (equal (nth 5 attributes) modtime))))) (defun dired-buffer-stale-p (&optional noconfirm) "Return non-nil if current dired buffer needs updating. ============================================================ ===File ~/tramp.el-diff===================================== *** tramp.el 26 Jun 2004 16:46:18 -0500 1.46 --- tramp.el 10 Jul 2004 15:10:30 -0500 *************** *** 2338,2349 **** (let* ((attr (file-attributes f)) (modtime (nth 5 attr))) (cond ((and attr (not (equal modtime '(0 0)))) - ;; Why does `file-attributes' return a list (HIGH - ;; LOW), but `visited-file-modtime' returns a cons - ;; (HIGH . LOW)? (let ((mt (visited-file-modtime))) (< (abs (tramp-time-diff ! modtime (list (car mt) (cdr mt)))) 2))) (attr (save-excursion (tramp-send-command --- 2338,2346 ---- (let* ((attr (file-attributes f)) (modtime (nth 5 attr))) (cond ((and attr (not (equal modtime '(0 0)))) (let ((mt (visited-file-modtime))) (< (abs (tramp-time-diff ! modtime mt)) 2))) (attr (save-excursion (tramp-send-command ============================================================ ===File ~/buffers.texi-diff================================= *** buffers.texi 23 Jun 2004 10:21:06 -0500 1.37 --- buffers.texi 10 Jul 2004 18:48:30 -0500 *************** *** 625,633 **** @c Emacs 19 feature @defun visited-file-modtime This function returns the current buffer's recorded last file ! modification time, as a list of the form @code{(@var{high} . ! @var{low})}. (This is the same format that @code{file-attributes} ! uses to return time values; see @ref{File Attributes}.) The function returns zero if the buffer has no recorded last modification time, which can happen, for instance, if the record has --- 625,633 ---- @c Emacs 19 feature @defun visited-file-modtime This function returns the current buffer's recorded last file ! modification time, as a list of the form @code{(@var{high} @var{low})}. ! (This is the same format that @code{file-attributes} uses to return ! time values; see @ref{File Attributes}.) The function returns zero if the buffer has no recorded last modification time, which can happen, for instance, if the record has ============================================================