Re: Plain simple unix timestamp with an HTTP GET

2010-06-04 Thread Ross
On Jun 3, 11:20 pm, livibetter wrote: > This? > > hwclock --utc --set --date="$(datestr="$(curlhttp://208.66.175.36:13/ > 2>/dev/null | cut -d \  -f 2-3)" ; echo ${datestr//-//})" > > Only hwclock, curl, cut, and Bash. > > PS. I didn't know I can set the time via hwclock, learned from Paul's > pos

Re: Plain simple unix timestamp with an HTTP GET

2010-06-03 Thread livibetter
I forgot to mention I redirect stderr to /dev/null, because curl returns error code 56 to me with this message "curl: (56) Failure when receiving data from the peer" On Jun 4, 11:20 am, livibetter wrote: > This? > > hwclock --utc --set --date="$(datestr="$(curlhttp://208.66.175.36:13/ > 2>/dev/n

Re: Plain simple unix timestamp with an HTTP GET

2010-06-03 Thread livibetter
This? hwclock --utc --set --date="$(datestr="$(curl http://208.66.175.36:13/ 2>/dev/null | cut -d \ -f 2-3)" ; echo ${datestr//-//})" Only hwclock, curl, cut, and Bash. PS. I didn't know I can set the time via hwclock, learned from Paul's post, but still didn't try to see if it does work. On J

Re: Plain simple unix timestamp with an HTTP GET

2010-06-03 Thread Paul Rubin
Ross writes: > I'd like to just quickly and with a minimum of parsing (ie no screen- > scraping) get a unix epoch timestamp (or another format if necessary). I haven't used this in a while and can't promise it still works: http://www.nightsong.com/phr/python/setclock.py -- http://mail.python.

Re: Plain simple unix timestamp with an HTTP GET

2010-06-03 Thread Ross
No - it's not really a python specific need, it's just what I'm using just now, and can't think of where else to ask. It's also my fav test- bed, as it's so easy. Your curl example is using grep and date which I don't have available. I have no fancy libraries, just core parsing capability. I foun

Re: Plain simple unix timestamp with an HTTP GET

2010-06-03 Thread livibetter
I don't know what tools do you have on embedded system, but I really don't think this has to be using Python. Here is what I would do on a normal desktop using your unique way to set up time: date -s "$(curl -s -I http://example.com | grep Date | cut -d \ -f 2-)" On Jun 4, 8:05 am, Ross wro

Plain simple unix timestamp with an HTTP GET

2010-06-03 Thread Ross
I'd like to just quickly and with a minimum of parsing (ie no screen- scraping) get a unix epoch timestamp (or another format if necessary). I thought with a quick second search on Google I'd find a URL where I could do a simple urllib2 based HTTP GET and have a timestamp returned to me. I don'