This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Finding either boot time or login time
- From: Ronald Fischer <fischerr dot external at infineon dot com>
- To: cygwin at cygwin dot com
- Date: Mon, 2 Feb 2009 14:11:11 +0000 (UTC)
- Subject: Re: Finding either boot time or login time
- References: <loom.20090130T125737-221@post.gmane.org> <4982FB77.7020505@byu.net> <loom.20090130T152913-409@post.gmane.org> <5.2.0.9.1.20090130164221.01ec8dd0@localhost> <f60fe000901300757l23e6466bu4250f71c8593013d@mail.gmail.com>
Mark J. Reed <markjreed <at> gmail.com> writes:
> One-liner to display the boot time:
>
> $ perl -lane 'print ~~localtime(time-$F[0])' /proc/uptime
Thanks a lot! This is great!
Would you mind explaining the ~~ trick? localtime returns a list, so
I would have concluded that applyiing ~ to this list would force it
into scalar context, so it would bitwise negate the number of elements
in the list. But this is obviously not done, because just by
trying out your code, I see that it works.
Ronald
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/