Hi,

Any reason to use --format=gnu? The default posix format seems to yield a 
better accuracy.

NB: Interesting that your initial `touch` command was also exactly on a 
millisecond.

-- Reuti


> Am 17.02.2026 um 12:59 schrieb [email protected]:
> 
> Dear all,
> 
> please let me know if I am wrong here.
> 
> I am trying to compress and extract a tar archive while trying to maintain 
> the modification timestamp in nanoseconds. The files are from a make system 
> that if the timestamps are not correctly restored will cause a rebuild of 
> some very time consuming components - that is the gist of it.
> 
> The simple test scenario below shows  where I think the timestamp accuracy 
> appears to get lost
>     • 
> touch test.txt
>     • stat test.txt
>   File: test.txt
>   Size: 0         Blocks: 0          IO Block: 4096   regular empty file
> Device: 8,1 Inode: 24520316    Links: 1
> Access: (0644/-rw-r--r--)  Uid: ( 1000/  oliver)   Gid: ( 1000/  oliver)
> Access: 2026-02-17 11:39:28.366000000 +0000
> Modify: 2026-02-17 11:39:28.366000000 +0000
> Change: 2026-02-17 11:39:28.366000000 +0000
>  Birth: 2026-02-17 11:25:59.010000000 +0000
>     • tar --full-time --utc --format=gnu --verbose -cf test.tar test.txt
> -rw-r--r-- oliver/oliver     0 2026-02-17 11:39:28.366 test.txt
>     • tar --full-time --utc --format=gnu --verbose -tf test.tar
> -rw-r--r-- oliver/oliver     0 2026-02-17 11:39:28 test.txt
>     • mkdir -p test && tar --full-time --utc --format=gnu --verbose -xf 
> test.tar -C test
> -rw-r--r-- oliver/oliver     0 2026-02-17 11:39:28 test.txt
>     • stat test.txt test/test.txt
>   File: test.txt
>   Size: 0         Blocks: 0          IO Block: 4096   regular empty file
> Device: 8,1 Inode: 24520316    Links: 1
> Access: (0644/-rw-r--r--)  Uid: ( 1000/  oliver)   Gid: ( 1000/  oliver)
> Access: 2026-02-17 11:39:28.366000000 +0000
> Modify: 2026-02-17 11:39:28.366000000 +0000
> Change: 2026-02-17 11:39:28.366000000 +0000
>  Birth: 2026-02-17 11:25:59.010000000 +0000
>   File: test/test.txt
>   Size: 0         Blocks: 0          IO Block: 4096   regular empty file
> Device: 8,1 Inode: 24649659    Links: 1
> Access: (0644/-rw-r--r--)  Uid: ( 1000/  oliver)   Gid: ( 1000/  oliver)
> Access: 2026-02-17 11:44:08.410000000 +0000
> Modify: 2026-02-17 11:39:28.000000000 +0000
> Change: 2026-02-17 11:44:08.410000000 +0000
>  Birth: 2026-02-17 11:44:08.410000000 +0000
> 
> It appears that at step 3 the timestamp in nanoseconds is not stored in the 
> archive test.tar and from this moment onwards is lost.
> 
> My system is Debian GNU/Linux 12 (bookworm), running on and Intel PC and the 
> filesystem is ext4.
> 
> uname -a shows
> Linux work-vm 6.1.0-42-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.159-1 
> (2025-12-30) x86_64 GNU/Linux
> 
> 
> Is there anything that I do wrong or is this a bug I stumbled upon?
> - perhaps a configuration issue?
> 
> Thank you very much in advance looking into this.
> 
> Kind regards,
> Oliver



Reply via email to