bug-coreutils
[Top][All Lists]
Advanced

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

Re: coreutils-5.1.2: patch for stat command, and a comment on the date c


From: Nelson H. F. Beebe
Subject: Re: coreutils-5.1.2: patch for stat command, and a comment on the date command
Date: Mon, 2 Feb 2004 08:49:23 -0700 (MST)

Thanks for the patches to coreutils-5.1.2 to fix the problem with the
zero nanosec values in output from stat.  They work nicely:

Old:

        % /usr/local/bin/stat --version
        stat (coreutils) 5.1.2

        % /usr/local/bin/stat /bin/true
          File: `/bin/true'
          Size: 312             Blocks: 8          IO Block: 65536  regular file
        Device: eeh/238d        Inode: 380         Links: 1
        Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/     sys)
        Access: 2003-12-09 09:02:56.000000000 -0700
        Modify: 1999-11-04 12:07:38.000000000 -0700
        Change: 1999-11-04 12:07:38.000000000 -0700

        % /usr/local/bin/ls -l --full-time /bin/true
        -rwxr-xr-x  1 root sys 312 1999-11-04 12:07:38.887783200 -0700 /bin/true

        % /usr/local/bin/stat -t /bin/true

        % /usr/local/bin/stat -t /bin/true
        /bin/true 312 8 81ed 0 0 ee 380 1 0 0 1070985776 941742458 941742458 
65536

New:
        % src/stat /bin/true
          File: `/bin/true'
          Size: 312             Blocks: 8          IO Block: 65536  regular file
        Device: eeh/238d        Inode: 380         Links: 1
        Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/     sys)
        Access: 2003-12-09 09:02:56.572619600 -0700
        Modify: 1999-11-04 12:07:38.887783200 -0700
        Change: 1999-11-04 12:07:38.888253600 -0700

The numbers 1070985776 941742458 941742458 are timestamps relative to
the 1-Jan-1970 epoch; those values also appear in the native IRIX
stat:

        % /sbin/stat /bin/true
        /bin/true:
                inode 380; dev 238; links 1; size 312
                regular; mode is rwxr-xr-x; uid 0 (root); gid 0 (sys)
                projid 0        st_fstype: xfs
                change time - Thu Nov  4 12:07:38 1999 <941742458>
                access time - Tue Dec  9 09:02:56 2003 <1070985776>
                modify time - Thu Nov  4 12:07:38 1999 <941742458>

The question is, when nanosec values are available, should they not
also appear in the terse output from GNU stat?  They don't in the
either the old or the new version:

        % /usr/local/bin/stat -t /bin/true
        /bin/true 312 8 81ed 0 0 ee 380 1 0 0 1070985776 941742458 941742458 
65536

        % src/stat -t /bin/true
        /bin/true 312 8 81ed 0 0 ee 380 1 0 0 1070985776 941742458 941742458 
65536

Also, it would be helpful if GNU date (also part of coreutils) could
input and output time values since the epoch given on the command
line, since that would make time conversions easy.  I know there is a
perl module to do that, and GNU gawk can do it like this:

        % gawk 'BEGIN{print strftime("%c", 941742458)}'
        Thu Nov  4 12:07:38 1999

Still, date is the obvious tool to provide such conversions.  As far
as I can tell, GNU date provides one of the needed conversions:

        % date '+%s'
        1075736647

but not the other

        % date -d 1075736647
        date: invalid date `1075736647'

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: address@hidden  -
- 155 S 1400 E RM 233                       address@hidden  address@hidden -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe  -
-------------------------------------------------------------------------------




reply via email to

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