cpdup(1): Use POSIX-defined timespec fields to be more portable
authorAaron LI <aly@aaronly.me>
Sun, 5 Apr 2020 00:51:56 +0000 (08:51 +0800)
committerAaron LI <aly@aaronly.me>
Sun, 5 Apr 2020 00:51:56 +0000 (08:51 +0800)
commit1a05b9d15ed4e0279e6992ceca212b8c9fefd8ae
treedf9df60709c51d2c672dc37edaee35c76ee88af3
parenta82ccc5779496d6bd554cbf6f55c5bc4a3372fe5
cpdup(1): Use POSIX-defined timespec fields to be more portable

While we defines 'st_atimespec', 'st_mtimespec' and 'st_ctimespec'
macros in 'struct stat', they are not defined on Linux and maybe other
platforms or C libraries.  Change to check the definitions of
'st_atime', 'st_mtime' and 'st_ctime' macros to check whether we're on a
modern POSIX (>= 2008) platform.

See also: https://github.com/DragonFlyBSD/cpdup/commit/7a715bd5cc6853c3973ce84a5df3c779e47082d1
Credit: https://github.com/ninja-build/ninja/pull/1513
bin/cpdup/cpdup.c
bin/cpdup/hcproto.c