bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: use of locale in "ls" again (Re: Japanese expression of date)


From: Paul Eggert
Subject: Re: use of locale in "ls" again (Re: Japanese expression of date)
Date: Thu, 20 Dec 2001 17:54:12 -0800 (PST)

> From: Miles Bader <address@hidden>
> Date: 21 Dec 2001 09:56:00 +0900
> 
> The main problem I have with this solution is that it seems rather
> unintuitive to see a file that was modified late yesterday as only
> having a time, especially if the file was modified close to 24 hours
> ago.  E.g., if it's now 10:30am, and I see a file listed as `10:45:32',
> then it _feels_ like the file was modified today, even though it wasn't

OK.  Would you prefer a rule that uses a date for a file modified
yesterday, even if the file is only a few seconds old?

There are a few wrinkles here that may not be immediately obvious
(at least, they weren't obvious to me until just now :-).

* First, ls uses dates for timestamps that are even slightly in the
  future.  This is intended to be a visual cue that you have clock
  skew problems.  (It's also required by POSIX, in the POSIX locale.)
  E.g. with the current ls:

    $ ls -l today future
    -rw-rw-r--    1 eggert   src             0 2001-12-20  future
    -rw-rw-r--    1 eggert   src             0 12-20 17:20 today

  That first file's time stamp is in the future.

  This useful property would no longer hold with the changed I
  proposed in my previous message, due to daylight saving transition
  problems.  For example, suppose the clock moves backward by 1 hour
  at 2001-10-28 02:00, and we run 'ls' at 23:30 that day on a file
  that is dated 00:15 that day.  The file is older than 24 hours, so
  it'll be labeled with today's date even though there is no clock
  skew issue.

* Conversely, the ambiguity of time stamps near a jump-forward DST
  change will be a 23-hour ambiguity, not the usual 1-hour ambiguity.
  For example, suppose the clock moves forward by 1 hour at 02:00 on
  April 1, 2001, and suppose we invoke 'ls' at 02:30 on April 2 on two
  files dated 2001-04-01 01:45 and 2001-04-02 01:45, respectively.
  Then the output would look like this:

    $ ls -l file1 file2
    -rw-rw-r--    1 eggert   src             0   01:45:00 file1
    -rw-rw-r--    1 eggert   src             0   01:45:00 file2

  file1 is 23 hours older than file2, but they appear to have the same
  time stamp.

If we decrease the window to less than 24 hours, the
clock-skew-indication problem will get worse.  If we increase the
window to greater than 24 hours (to 144 hours, say), we'll need a
day-of-the-week indicator, and this format is just a little bit too
weird even for me:

   $ ls -l .profile today
   -r--r--r--    1 eggert   eggert       4012 2001-11-20 .profile
   -rw-rw-r--    1 eggert   eggert          0 4 16:10:01 today

(That '4' stands for Thursday.)  Yuck.


So perhaps it would be simpler and clearer to use a date for a file
last-modified yesterday, even if the file is just a few seconds old.
That's easy to explain, and avoids these confusing situations.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]