From: Luc Teirlinck <teirllm@dms.auburn.edu>
Subject: time values
Date: Sat, 10 Jul 2004 19:33:21 -0500 (CDT) [thread overview]
Message-ID: <200407110033.i6B0XLF08165@raven.dms.auburn.edu> (raw)
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
============================================================
next reply other threads:[~2004-07-11 0:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-11 0:33 Luc Teirlinck [this message]
2004-07-11 8:23 ` time values Kai Grossjohann
2004-07-11 13:35 ` Andreas Schwab
2004-07-11 14:35 ` Alex Schroeder
2004-07-11 15:13 ` Luc Teirlinck
2004-07-11 15:18 ` Luc Teirlinck
2004-07-12 3:26 ` Luc Teirlinck
2004-07-11 15:37 ` Luc Teirlinck
2004-07-11 15:57 ` Luc Teirlinck
2004-07-11 23:23 ` Richard Stallman
2004-07-12 18:22 ` Luc Teirlinck
2004-07-17 20:33 ` Kai Grossjohann
2004-07-11 23:23 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200407110033.i6B0XLF08165@raven.dms.auburn.edu \
--to=teirllm@dms.auburn.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).