This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: Finding either boot time or login time
- From: "Cooper, Karl \(US SSA\)" <karl dot cooper at baesystems dot com>
- To: "Jerry D. Hedden" <jdhedden at 1979 dot usna dot com>, <cygwin at cygwin dot com>
- Date: Mon, 2 Feb 2009 11:54:15 -0500
- Subject: RE: Finding either boot time or login time
> Mark J. Reed writes:
>> One-liner to display the boot time:
>> $ perl -lane 'print ~~localtime(time-$F[0])' /proc/uptime
>
> Ronald Fischer wrote:
>> Would you mind explaining the ~~ trick?
>
> Clever tricks are interesting, but definitely are an obfuscation.
> This makes things more plain:
>
> perl -lane 'print(scalar(localtime(time() - int($F[0]))))'
> /proc/uptime
I don't know perl, but I did try both of these one-liners on my
Cygwin 1.7 setup, and the output differs (by one second). I thought
that was interesting.
--
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/