diff options
author | Jeremy Allison <jra@samba.org> | 1998-01-24 08:49:21 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1998-01-24 08:49:21 +0000 |
commit | 4f650dab6f867bda2beeeda71b2b97e75834853f (patch) | |
tree | b67637d60b942fc454301cbc614c91613901284a /source3/lib/time.c | |
parent | a215c98602c0849819a50de6b13f8c41824ef08a (diff) | |
download | samba-4f650dab6f867bda2beeeda71b2b97e75834853f.tar.gz samba-4f650dab6f867bda2beeeda71b2b97e75834853f.tar.bz2 samba-4f650dab6f867bda2beeeda71b2b97e75834853f.zip |
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)
Diffstat (limited to 'source3/lib/time.c')
-rw-r--r-- | source3/lib/time.c | 19 |
1 files changed, 19 insertions, 0 deletions
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; +} |