delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/02/02/11:54:30

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.2 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER
X-Spam-Check-By: sourceware.org
Message-Id: <7b4dai$em8g8@dmzms99901.na.baesystems.com>
X-SENDER-IP: 10.37.193.65
X-SENDER-REPUTATION: None
X-SENDER-IP: 10.40.167.5
X-SENDER-REPUTATION: None
content-class: urn:content-classes:message
MIME-Version: 1.0
Subject: RE: Finding either boot time or login time
Date: Mon, 2 Feb 2009 11:54:15 -0500
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>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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
>=20
> Ronald Fischer wrote:
>> Would you mind explaining the ~~ trick?
>=20
> Clever tricks are interesting, but definitely are an obfuscation.
> This makes things more plain:
>=20
> perl -lane 'print(scalar(localtime(time() - int($F[0]))))'
> /proc/uptime=20
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/

- Raw text -


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