Search code examples
linuxubuntugcctimearchive

Ubuntu linux: why "ar" command shows weird date/time information of archive?


I'm using ubuntu linux 16.04, just created a "a.c" file, I used

gcc -c a.c

to get a.o, and

ar rc liba.a a.o

to generate archive.

But when I use ar command to see its information, I got weird date information:

$ ar tv liba.a
rw-r--r-- 0/0   1408 Jan  1 08:00 1970 a.o

The date is not Jan 1st, the time is not 08:00 Why I get this information?

Thanks.


Solution

  • "By default the [linux] ar command creates deterministic archives which do not contain time stamps."

    If you want to include timestamps, use the U modifier:

    ar tvU libra.a