Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site aecom.UUCP Path: utzoo!linus!security!genrad!decvax!harpo!floyd!cmcl2!rocky2!cucard!aecom!naftoli From: naftoli@aecom.UUCP Newsgroups: net.unix-wizards Subject: Re: Strange time() vs. stat() bug Message-ID: <292@aecom.UUCP> Date: Tue, 6-Dec-83 13:28:21 EST Article-I.D.: aecom.292 Posted: Tue Dec 6 13:28:21 1983 Date-Received: Fri, 9-Dec-83 05:15:14 EST References: <34@eneevax.UUCP> Organization: Albert Einstein Coll. of Med., NY Lines: 22 >> If I write to a tty device and then close it, a stat 10 seconds later >> usually does not show it to have been modified when I did the write+close, >> but instead, 5 to 10 seconds later! If I use stat() instead of time() I >> get the "right" value (which then remains consistent). Using sync() will >> also make the value remain consistent (thus "time()" will be OK in the >> program below). I took a look at the code to the stat system call and it seems that the access, change, and mod times are taken straight off the disk as opposed to the in core version. This answers why sync() clears up the confusion. As to possible reasons for this, I don't have a clue. It seems to me that this should have been detected earlier since programs like finger(1) will have the terminal idle times only correct as of the last sync(). By the way, the code I looked at was INteractive's System 3. Probably the same in standard System III and others also. Robert Berlinger Systems Support {esquire,philabs,cucard}!aecom!naftoli