Keeping 'order' without RTC.

I did say network, not internet. And he might be transfering files by usb stick, not the network.
Reply to
William Unruh
Loading thread data ...
No internet connection is required at all. Just configure one of the other systems on the network as an NTP server.
Reply to
Rob
You seem to be telling me what does or does not work well for me, based solely on your own experience.
--
http://www.greenend.org.uk/rjk/
Reply to
Richard Kettlewell
It has to know the right time somehow though, by using NTP? :-)
--
Chris Green
Reply to
cl
forget NTP how about just stetting the damn time manually from the command line before starting, or am I missing something obvious here.
--
Love -- the last of the serious diseases of childhood.
Reply to
alister
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
??

Reply to
not.socialnetwork
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.
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.
Reply to
Rob
That's fine for a system where you have access but what about remote monitoring systems which are set up to restart after power outages etc.?
--
Chris Green
Reply to
cl
No, you're not missing anything.
My RPi is always run headless over SSH, so installing and configuring ntpd was an obvious no-brainer and one of the first things I did when it arrived.
However, if you only have an A or for some reason don't want to or can't be bothered to put your B/B+/2B on a LAN, then its back to the good old days of 8 bit systems and getting a date prompt each time you boot up. It should be simple enough to configure your RPi and/or write a short script to prompt for the date.
If you don't want to be bothered even with that, just set up a link to your version control system from your RPi. Not got a version control system already? Then you're scarcely a serious programmer yet, are you?
--
martin@   | Martin Gregorie 
gregorie. | Essex, UK 
 Click to see the full signature
Reply to
Martin Gregorie
When you have no network and do need the RTC time, you need to add an RTC.
Reply to
Rob
You can always do this manually by including a version number on the file name. Simple, and the way we did it on late 60s mainframes and early 8- bit home computers. Of course, we also tended to back up everything on a daily basis: if you're not doing that you should start doing it.
If you don't want to remember to rename files each time you change them, then install a version control system, which will keep track of the latest version of each file and let you revert to an earlier copy if needed. Version control packages are part of Raspbian: cvs, git and svn are all just a download away. These are not clock-dependent and use their own internal version numbering systems.
But you still need to make regular backups: SD cards are easier to corrupt than disks. All you need to make backups on an RPi is a USB SD card reader - the software is already installed.
--
martin@   | Martin Gregorie 
gregorie. | Essex, UK 
 Click to see the full signature
Reply to
Martin Gregorie
No I am simply saying that vcs for binary files don't get you much.
I don't give a damn what you do. You could beat your hard drive senseless with a 20 LB hammer for all I care.
Reply to
Baho Utot
the OP was trying to transfer files too his Pi via a memory stick so I naturally infer he has access to the pi itself
--
Eat shit -- billions of flies can't be wrong.
Reply to
alister
Apart from version control.
Reply to
Rob Morley
No. A (GPS or in the US the signal from Boulder CO that all the "auto setting" clocks use) radio receiver would work just fine to feed it a known clock signal.
No 'internet' connection. No NTP (to get the current time value).
Reply to
Rich
You could also have ntpd look at the files (eg assuming you run syslogd or rsyslogd, the files in /var/log) and take the last time on one of those files as the current time. In general you will tnen be out minutes or hours, rather than decades.
Link? Do you mean network connection (which you just said did not exist)? Or what is this link?
"If you do not think or act like me, you are not worth even talking to" Sheesh.
Reply to
William Unruh
My mistake: forgot I was addressing a stand-alone, non-networked RPi.
But still, if the OP doesn't want to edit version ids in the file name then setting up a local VCS is the obvious way to maintain sequential control of changes to a file on any machine without a clock.
..only because I have a feeling that the OP is one of the resident trolls. If he isn't, I apologise.
However, as version control systems have been around for over 25 years now and they are a near-perfect get-out-of-jail-free card if you screw an edit while having a bad day, I do expect a competent programmer to be as familiar with VCS systems about as much as I expect a C programmer to be familiar with Make or his local equivalent.
--
martin@   | Martin Gregorie 
gregorie. | Essex, UK 
 Click to see the full signature
Reply to
Martin Gregorie
[snip]
What is the installed software? Would you please elaborate? I'm new to the RPi and linux and am interested in knowing how to backup the RPi using a Mac.
Thank you for any information you may provide.
Ray
Reply to
RRansil
Or an MSF receiver in the UK or DCF receivers in much of Europe - there's a powerful one near Frankfurt.
Details are here:
formatting link

This includes details of how to build a cheap receiver and a Linux program to interface it with ntpd. The receiver as described expects to be powered by the DTR pin on a serial port and to send data by flapping the DCD pin up and down, so its probably fairly easy to make it use an RPI's GPIO pins instead.
--
martin@   | Martin Gregorie 
gregorie. | Essex, UK 
 Click to see the full signature
Reply to
Martin Gregorie
cp or dd
man dd or man cp for more info. If you don't have man installed, then type "man dd" into Google.
Reply to
mm0fmf

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.