Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Unknown Newsgroups: comp.os.linux.misc,comp.sys.raspberry-pi Subject: Re: Keeping 'order' without RTC. Date: Tue, 3 Mar 2015 07:37:30 +0000 (UTC) Organization: A noiseless patient Spider Lines: 79 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 3 Mar 2015 07:37:30 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="82693a662bde54e9e44daf9b2ec6ed12"; logging-data="32473"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+A0zTRzi2tVncm/ZEW7+m0kxt8r5WhP0g=" User-Agent: Pan/0.133 (House of Butterflies) Cancel-Lock: sha1:YLY7G/JESe8dVKfWXxsGJ/jmG9M= Xref: csiph.com comp.os.linux.misc:13849 On Sun, 01 Mar 2015 11:17:40 +0000, Rob wrote: > not.socialnetwork@gmail.com wrote: >> In article >> , >> Richard Kettlewell wrote: >> >>> not.socialnetwork@gmail.com writes: >>> > When you transfer a dir of script/s & data-files to rPi from your >>> > PC, via USBstik, there's a problem, since the rPi has no >>> > RealTimeClock. >>> > >>> > So the important abilty to 'evaluate' files by their recentcy is >>> > lost. It's a universal truth that you'll want to get the most-recent >>> > cup-of-coffee and not the 17th most-recent that you put-down. That's >>> > why stacks are used. >>> > >>> > What algorithm do you use to solve this problem? >>> >>> I keep files that have multiple version in a version control system. >>> >> Obviously I've explained the problem badly. If Newton was called away >> from his desk of papers; when he returned he'd want the "stack" to >> still represent the heirarchy of the problem that he had been working >> on. >> He doesn't need the REAL time - only the order/sequence. >> >> For this problem the PC generates real-time-ordered files: >> a1, a2, ...an >> which are copied to the rPi with the same names & timestamps >> b1,b2, ..bn >> >> ** The rPi has no access to mains power, nor real-time source. ** The >> rPi's only control is the power ON/OF, which renames files eg. from >> test1.ogg to ztest1.ogg or test1.ogx, depending on the audio-prompt >> playing when the power is cut. >> >> Would this work & if so, what's the script-code:---- >> >> At the time of `cp an bn`, PC & rPi files a 'synced'. Only when rPi >> writes is sync lost. >> If every write by rPi is dated after the newest file the order >> will be kept. >> So when rPi powers-up it could set a file to the time of the newest >> file:CLK >> >> replace the existing code for: >> cp with Cp >> mv with Mv >> >> and add subroutines: >> Cp () >> { add 1 minute to CLK and use that to date cp $1 $2 >> } >> >> Mv () >> similar >> >> ?? > > Sure you can write that! Why would you need to ask here? > > Normally the Pi writes its time regularly to a file > /etc/fake-hwclock.data and when it boots it uses that time as a starting > point. When you cleanly shutdown the Pi it is quite accurate, when you > just pull the plug it may be an hour or so in the past. > Is that because, it sets a timer, from the fake-hwclock.data when it boots and it adds that to fake-hwclock.data when it halts-properly? File: fake-hwc~ck.data == 2015-01-29 01:17:01 -> date == Tue Mar 3 09:36:43 SAST 2015 > Of course you can do a similar thing when you check the files on the USB > stick and set the time to the newest when that is past the current time > in the Pi. Perhaps if I translated it to I could understand that?