Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Pascal J. Bourguignon" Newsgroups: comp.lang.c Subject: Re: [sot] file times / file metadata Date: Wed, 22 Nov 2017 01:44:21 +0100 Organization: Informatimago Lines: 38 Message-ID: References: <5a91718b-b272-4cdf-adfd-8f6777851b23@googlegroups.com> <9b5fe3ff-a704-4776-947c-d795fbc303ff@googlegroups.com> <009fcbb1-57f4-4835-836b-216066bcf329@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain X-Trace: individual.net qqYUJQzngvv0M1/5E+n1eQk3VH1D9mn1byBsHXflnaZLLnT9A+ Cancel-Lock: sha1:YzAxZDhlYjE0OGQ4ZmNlMzhiNGYyNDViODgyNDE3ODg3OWUyOGViYw== sha1:hf+IdEY99JYPIT++VrvpTl6f0xs= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (darwin) Xref: csiph.com comp.lang.c:123262 fir writes: > its interesting but if that would be true then nodify time in copying > would be always bigger than creation and i talked my experiments > showed id dont look like that (and that shows it just seems not be > true) You're right. cp will indeed update the mtime so it reports the original timestamp instead of that of the copied file. mtime is user modifiable, but ctime is protected by the kernel (only root could modify it). But the point is that it doesn't matter. Those are not semantic times and should not taken as such. For example, when you update a file, you have basically two ways to do it: 1- Open the file in R/W mode, modify it, close it. 2- Open the file in R mode, create a new file in W mode, copy the data while modifying it on the fly. Close both files. Rename the old file as a backup file, rename the new file as the old file. There are good advantages of doing it the second way. But obvious it changes the ctime! Semantically, for a successful update, both ways should be equivalent: the date the document was created, and the date the document was modified should be the same. This won't be reflected in the time stamps kept by the file system. -- __Pascal J. Bourguignon http://www.informatimago.com