www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/02/02/09:34:22

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <loom.20090202T140523-18@post.gmane.org>
References: <loom DOT 20090130T125737-221 AT post DOT gmane DOT org> <4982FB77 DOT 7020505 AT byu DOT net> <loom DOT 20090130T152913-409 AT post DOT gmane DOT org> <5 DOT 2 DOT 0 DOT 9 DOT 1 DOT 20090130164221 DOT 01ec8dd0 AT localhost> <f60fe000901300757l23e6466bu4250f71c8593013d AT mail DOT gmail DOT com> <loom DOT 20090202T140523-18 AT post DOT gmane DOT org>
Date: Mon, 2 Feb 2009 09:34:06 -0500
Message-ID: <1ff86f510902020634g49262880s20929642e46a9a33@mail.gmail.com>
Subject: Re: Finding either boot time or login time
From: "Jerry D. Hedden" <jdhedden AT 1979 DOT usna DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019