delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/01/30/10:58:24

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <loom.20090130T152913-409@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>
Date: Fri, 30 Jan 2009 10:58:11 -0500
Message-ID: <183c528b0901300758i4c633f65t7162f96f246d1d17@mail.gmail.com>
Subject: Re: Finding either boot time or login time
From: Brian Mathis <brian DOT mathis AT gmail 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

On Fri, Jan 30, 2009 at 10:33 AM, Ronald Fischer
<fischerr DOT external AT infineon DOT com> wrote:
> Eric Blake <ebb9 <at> byu.net> writes:
>> man uptime
>
> I have thought of uptime, but this requires doing date calculation (I have to
> subtract the uptime from the current time), which I wanted to avoid; plus I
> wanted to have it reproducible (i.e. if I calculate the "startup time" twice
> in succession, I wanted to get the same result - using the uptime calculation
> might well give differences of, say, one, in rare cases 2, seconds for the
> startup time on repeated calculations.
>
> But it seems there is no alternative. I had not expected that Windows would
> not log such events, like starting up or having some user logged in...
>
> Ronald

This information is available in windows by using one of two commands:
    net stats srv
or
    systeminfo

In both cases, you will need to grep (if calling from cygwin) or use
the windows "find" command (equivalent of grep), to isolate just the 1
line.

I've noticed that, on Vista, "net stats srv" always seems to return
1980, while systeminfo returns the correct result.

If that doesn't work for you, I'm sure there are other ways to do it.
You might need to write some vbs and query WMI to get the uptime
(http://www.microsoft.com/technet/scriptcenter/resources/qanda/sept04/hey0907.mspx)
 Or you can install the "uptime" tool from Microsoft
(http://support.microsoft.com/kb/232243)

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