From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#9000: patch for higher-resolution time stamps Date: Mon, 04 Jul 2011 23:40:43 -0700 Organization: UCLA Computer Science Department Message-ID: <4E12B1EB.9060406@cs.ucla.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1309848149 22868 80.91.229.12 (5 Jul 2011 06:42:29 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 5 Jul 2011 06:42:29 +0000 (UTC) To: 9000@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 05 08:42:25 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QdzKy-0007c9-CK for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Jul 2011 08:42:24 +0200 Original-Received: from localhost ([::1]:56111 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdzKx-00008W-Bx for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Jul 2011 02:42:23 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:43483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdzKf-000084-1r for bug-gnu-emacs@gnu.org; Tue, 05 Jul 2011 02:42:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QdzKd-000727-Ok for bug-gnu-emacs@gnu.org; Tue, 05 Jul 2011 02:42:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51135) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdzKd-000722-Es for bug-gnu-emacs@gnu.org; Tue, 05 Jul 2011 02:42:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QdzKc-0005EP-NB; Tue, 05 Jul 2011 02:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Jul 2011 06:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 9000 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.130984807420054 (code B ref -1); Tue, 05 Jul 2011 06:42:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Jul 2011 06:41:14 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QdzJp-0005DP-Ny for submit@debbugs.gnu.org; Tue, 05 Jul 2011 02:41:14 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QdzJm-0005DC-1P for submit@debbugs.gnu.org; Tue, 05 Jul 2011 02:41:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QdzJf-0006ms-7o for submit@debbugs.gnu.org; Tue, 05 Jul 2011 02:41:04 -0400 Original-Received: from lists.gnu.org ([140.186.70.17]:34089) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdzJe-0006mo-TY for submit@debbugs.gnu.org; Tue, 05 Jul 2011 02:41:03 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:42099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdzJd-0008S2-1l for bug-gnu-emacs@gnu.org; Tue, 05 Jul 2011 02:41:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QdzJb-0006mW-7M for bug-gnu-emacs@gnu.org; Tue, 05 Jul 2011 02:41:00 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:41396) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdzJa-0006m8-NY for bug-gnu-emacs@gnu.org; Tue, 05 Jul 2011 02:40:59 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id E7C7A39E810F for ; Mon, 4 Jul 2011 23:40:48 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id S862p8nZlDtC for ; Mon, 4 Jul 2011 23:40:47 -0700 (PDT) Original-Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id DCD9A39E80F8 for ; Mon, 4 Jul 2011 23:40:47 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110516 Thunderbird/3.1.10 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 05 Jul 2011 02:42:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:48012 Archived-At: Currently, Emacs supports time stamps to at most microsecond resolution, and often to only 1-second resolution, even though most modern systems have nanosecond-resolution time stamps for clock and file time stamps. This leads to some problems, for example: * "C-u M-x copy-file RET A RET B" discards the fractional part of A's time stamp when copying A to B (except for Windows, which I've been told uses special code to preserve the time stamp correctly). * The file-attributes function truncates file time stamps to one-second resolution, making it impossible for a dired written in Emacs to emulate the behavior of "ls --full-time". * (format-time-string "%s.%N") is supposed to output nanosecond-resolution time stamps, but on the Emacs trunk it always outputs a multiple of one microsecond, even when the system clock supports nanosecond resolution. * If some other process modifies a file during the same second that Emacs gets the file's time stamp, Emacs won't notice the conflict, as the visited-file-modtime function supports only 1-second resolution. If Emacs used nanosecond-resolution time stamps, this race condition would be much less likely. None of these problems are fatal, but they are annoyances that could lead to real problems (e.g., when working with "make", which uses high-resolution file time stamps). I've proposed a patch for this: http://lists.gnu.org/archive/html/emacs-devel/2011-07/msg00015.html http://lists.gnu.org/archive/html/emacs-devel/2011-07/msg00016.html http://lists.gnu.org/archive/html/emacs-devel/2011-07/msg00017.html http://lists.gnu.org/archive/html/emacs-devel/2011-07/msg00018.html http://lists.gnu.org/archive/html/emacs-devel/2011-07/msg00019.html http://lists.gnu.org/archive/html/emacs-devel/2011-07/msg00020.html http://lists.gnu.org/archive/html/emacs-devel/2011-07/msg00021.html Stefan asked me in to make the patch more upward-compatible, by appending a new picosecond count to the end of the time stamp list, rather than changing the microsecond to a nanosecond count (which would likely break more code). I'll do that soon, but thought I'd first file a bug report to make this whole issue easier to track. In part I am also following up to Stefan's suggestion to have a bug report for this issue.