stat st_birthtim(espec)

Corinna Vinschen
Mon Oct 19 12:01:27 GMT 2020

On Oct 19 02:06, Phil Budne wrote:
> While checking if an OSS project of mine (
> compiled cleanly under Cygwin, I was happy to discover that struct
> stat contains file birth time as on various BSD based systems.
> BUT, I was unhappy to find out that MacOS 10.15 and Cygwin 3.1.7 have
> non-overlapping definitions for birth time information.
> FreeBSD 12, NetBSD 9, and OSX 10.15 all have a "timespec" available as
> "st_birthtimespec", but Cygwin does not.
> On FreeBSD, NetBSD, and Cygwin the actual member of struct stat is
> st_birthtim, but on OSX, the member is st_birthtimespec, and there is
> no define for st_birthtim.
> A st_birthtimespec define in cygwin/stat.h would make it easier to
> write portable code.

Well, portable code should use the st_atim/st_mtim/st_ctim members
directly and not use st_birthtim at all.

For the headers we're usually looking for Linux compatibility in the
first place and if that's any indication, we should add all the
st_XYZtimensec members, but *only* if __USE_XOPEN2K8 is defined
(equivalent _XOPEN_SOURCE >= 700 for Cygwin/newlib)

GLibc does not provide any st_XYZtimespec definitions, though.  I don't
think it really makes a lot of sense to add those with portability in


More information about the Cygwin mailing list