Exemple #1
0
IoObject *IoFile_lastAccessDate(IoFile *self, IoObject *locals, IoMessage *m)
{
	/*doc File lastAccessDate
	Returns a Date object containing the last date and
	time the file was accessed.
	*/

	struct stat *s = IoFile_statPointer(self, locals, m);
#ifndef _POSIX_C_SOURCE
	struct timeval tv = timespec2timeval(s->st_atimespec);
#else
	struct timeval tv = time_t2timeval(s->st_atime);
#endif


	return IoDate_newWithTimeval_(IOSTATE, tv);
}
Exemple #2
0
IO_METHOD(IoFile, lastInfoChangeDate)
{
	/*doc File lastInfoChangeDate
	Returns a Date object containing the last date and
	time the file's meta info was changed.
	*/

	struct stat *s = IoFile_statPointer(self, locals, m);

#ifndef _POSIX_C_SOURCE
	struct timeval tv = timespec2timeval(s->st_ctimespec);
#else
	struct timeval tv = time_t2timeval(s->st_ctime);
#endif


	return IoDate_newWithTimeval_(IOSTATE, tv);
}
Exemple #3
0
IoObject *IoFile_lastDataChangeDate(IoFile *self, IoObject *locals, IoMessage *m)
{
	/*doc File lastDataChangeDate
	Returns a Date object containing the last date and
	time the file's contents were changed.
	*/

	struct stat *s = IoFile_statPointer(self, locals, m);
#ifndef _POSIX_C_SOURCE
	struct timeval tv = timespec2timeval(s->st_mtimespec);
#else
	struct timeval tv = time_t2timeval(s->st_mtime);
#endif
	/*
	struct gettv get_tv;
	struct timezone timezone;
	struct tm *t;
	gettimeofday(&get_tv, &timezone);
	printf("stattv.tv_sec = %i\n", tv.tv_sec);
	printf("get_tv.tv_sec = %i\n", get_tv.tv_sec);
	*/
	return IoDate_newWithTimeval_(IOSTATE, tv);
}