This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Finding either boot time or login time


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]