[squeak-dev] File creation time wrong on Mac
John M McIntosh
johnmci at smalltalkconsulting.com
Mon Jul 28 21:31:46 UTC 2008
Check the call where the primitive primitiveDirectoryLookup
(FileDirectory default directoryContentsFor: )
is called that invokes the platform specific code in
sqMacUnixFileInterface.c which has the code below
sqInt dir_Lookup(char *pathString, sqInt pathStringLength, sqInt index,
/* outputs: */ char *name, sqInt *nameLength, sqInt *creationDate,
sqInt *modificationDate,
sqInt *isDirectory, squeakFileOffsetType *sizeIfFile)
...
/* last change time */
*creationDate= convertToSqueakTime(statBuf.st_ctime);
/* modification time */
*modificationDate= convertToSqueakTime(statBuf.st_mtime);
...
where
/*
* [XSI] This structure is used as the second parameter to the fstat(),
* lstat(), and stat() functions.
*/
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! */
};
The iPhone and new OSX version has
*creationDate = convertToSqueakTime([fileAttributes objectForKey:
NSFileCreationDate ]);
*modificationDate = convertToSqueakTime([fileAttributes objectForKey:
NSFileModificationDate]);
These seem correct but I don't have a test case handy.
On Jul 28, 2008, at 3:32 PM, stephane ducasse wrote:
> Hi all
>
> Is it a well-known bug that the creation time is incorrectly
> reported on Mac?
>
>
> Time dateAndTimeFromSeconds:
> (FileDirectory default
> directoryEntryFor: 'ESUG2008.txt') creationTime
>
> It seems to be confused and return the last opened or last modified
> date.
>
> Then is there a way to modify the creationTime and other
> characteristic of a file?
>
> Stef
>
--
=
=
=
========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
=
=
=
========================================================================
More information about the Squeak-dev
mailing list
|