Comment 1 for bug 296955

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote : Re: [Bug 296955] [NEW] file-ctime and file-mtime giving wrong value

On Nov 11, 2008, at 4:22 PM, Derick Eddington wrote:

> Also, is there some POSIX facility to get finer-than-second resolution
> of files' ctime and mtime that file-ctime and file-mtime are being
> left
> open to supporting in the future, and that's why these values are
> multiplied by #e1e9?

What do I know! Looks like there is a nanosecond field for stat.

In /usr/include/sys/stat.h under Darwin:

struct stat {
         dev_t st_dev; /* [XSI] ID of device
containing file */
         ino_t st_ino; /* [XSI] File serial number */
         mode_t st_mode; /* [XSI] Mode of file (see
below) */
         nlink_t st_nlink; /* [XSI] Number of hard
links */
         uid_t st_uid; /* [XSI] User ID of the file */
         gid_t st_gid; /* [XSI] Group ID of the
file */
         dev_t st_rdev; /* [XSI] Device ID */
#ifndef _POSIX_C_SOURCE
         struct timespec st_atimespec; /* time of last access */
         struct timespec st_mtimespec; /* time of last data
modification */
         struct timespec st_ctimespec; /* time of last status
change */
#else
         time_t st_atime; /* [XSI] Time of last access */
         long st_atimensec; /* nsec of last access */
         time_t st_mtime; /* [XSI] Last data
modification time */
         long st_mtimensec; /* last data modification
nsec */
         time_t st_ctime; /* [XSI] Time of last status
change */
         long st_ctimensec; /* nsec of last status
change */
#endif
         off_t st_size; /* [XSI] file size, in bytes */
         blkcnt_t st_blocks; /* [XSI] blocks allocated
for file */
         blksize_t st_blksize; /* [XSI] optimal blocksize
for I/O */
         __uint32_t st_flags; /* user defined flags for
file */
         __uint32_t st_gen; /* file generation number */
         __int32_t st_lspare; /* RESERVED: DO NOT USE! */
         __int64_t st_qspare[2]; /* RESERVED: DO NOT USE! */
};