Bug 254593

Summary: stat: Include nanoseconds in the timestamp in the default output format
Product: Base System Reporter: Peterr346 <pof10534>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Some People CC: 0mp, Rincebrain, akw24542, fbsd-bugzilla
Priority: --- Keywords: feature, needs-patch
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Peterr346 2021-03-27 01:09:14 UTC
Description:

There are users who want to have nanoseconds in stat command, because these users use file systems like ZFS which internally stores nanosecond timestamps.

https://forums.freebsd.org/threads/how-to-change-the-stat-command-time-format-because-of-nanoseconds.79045/#post-495945


I also agree that it must be displayed as standard.

That means

Current behavior only with stat command:
stat /
159 2 drwxr-xr-x 25 root wheel 1048 512 "Feb 24 19:25:21 2021" "Mar 27 02:39:54 2021" "Mar 27 02:39:54 2021" "Jan  1 00:59:59 1970" 32768 8 0 /


Expected behavior:
stat /
159 2 drwxr-xr-x 25 root wheel 1048 512 

Accessed: "Mar 27 02:39:54.640747015 2021" 
Modified: "Mar 27 02:39:54.640747015 2021" 
Changed:  "Mar 27 02:39:54.640747015 2021" 
Created:  "Jan  1 00:59:59.000000000 1970" 

32768 8 0 /
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2021-03-27 01:51:57 UTC
One may want to create a feature request upstream (OpenZFS) for this
Comment 2 Rich Ercolani 2021-03-27 16:13:38 UTC
I don't think OpenZFS is the correct upstream for a requested change in stat(1)'s output.
Comment 3 David Schlachter 2021-04-02 01:18:50 UTC
stat is capable of showing nanoseconds, take a look at Bug 253370. This would just be a question of whether the default format should be changed.
Comment 4 akww244 2021-04-07 01:18:20 UTC
(In reply to David Schlachter from comment #3)

> stat is capable of showing nanoseconds, take a look at Bug 253370. 
> This would just be a question of whether the default format should be changed.

I think here only changing the default format is requested only for stat without additional commands.



>Expected behavior:
>stat /
>159 2 drwxr-xr-x 25 root wheel 1048 512 

>Accessed: "Mar 27 02:39:54.640747015 2021" 
>Modified: "Mar 27 02:39:54.640747015 2021" 
>Changed:  "Mar 27 02:39:54.640747015 2021" 
>Created:  "Jan  1 00:59:59.000000000 1970" 

>32768 8 0 /