From 4f650dab6f867bda2beeeda71b2b97e75834853f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 24 Jan 1998 08:49:21 +0000 Subject: Added get_create_time() function to time.c. This gets the minimum timestamp associated with a file. reply.c and trans2.c then return this as the create time. Designed to fix problems with VC++ and others. Jeremy. (This used to be commit e3d5f6196d6eff707c78941696a368216e2a7410) --- source3/lib/time.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source3/lib') diff --git a/source3/lib/time.c b/source3/lib/time.c index 5e6d01215f..f60af60c7a 100644 --- a/source3/lib/time.c +++ b/source3/lib/time.c @@ -480,3 +480,22 @@ char *timestring(void ) return(TimeBuf); } +/**************************************************************************** + return the best approximation to a 'create time' under UNIX from a stat + structure. +****************************************************************************/ + +time_t get_create_time(struct stat *st) +{ + time_t ret = MIN(st->st_ctime, st->st_mtime); + time_t ret1 = MIN(ret, st->st_atime); + + if(ret1 != (time_t)0) + return ret1; + + /* + * One of ctime, mtime or atime was zero (probably atime). + * Just return MIN(ctime, mtime). + */ + return ret; +} -- cgit