Re: Finding either boot time or login time

2009-02-02 Thread Mark J. Reed
On Mon, Feb 2, 2009 at 9:11 AM, Ronald Fischer wrote: > Would you mind explaining the ~~ trick? Not at all, but I'll do so offlist. Perl-fu is not on-topic for Cygwin. On Mon, Feb 2, 2009 at 9:34 AM, Jerry D. Hedden wrote: > Clever tricks are interesting, but definitely are an obfuscation. It'

RE: Finding either boot time or login time

2009-02-02 Thread Owen Rees
--On 02 February 2009 11:54 -0500 Cooper, Karl \(US SSA\) wrote: 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. I get a one second difference between the two formulae as well (due to the

RE: Finding either boot time or login time

2009-02-02 Thread Cooper, Karl (US SSA)
> 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: >

Re: Finding either boot time or login time

2009-02-02 Thread Jerry D. Hedden
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

Re: Finding either boot time or login time

2009-02-02 Thread Ronald Fischer
Mark J. Reed 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 forc

Re: Finding either boot time or login time

2009-01-30 Thread Owen Rees
--On 30 January 2009 10:58 -0500 Brian Mathis wrote: I've noticed that, on Vista, "net stats srv" always seems to return 1980, while systeminfo returns the correct result. On this Vista system right now "net stats srv" says: Statistics since 27/01/2009 16:04:50 systeminfo says System Boot

Re: Finding either boot time or login time

2009-01-30 Thread Brian Mathis
On Fri, Jan 30, 2009 at 10:33 AM, Ronald Fischer wrote: > Eric Blake 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

Re: Finding either boot time or login time

2009-01-30 Thread Mark J. Reed
One-liner to display the boot time: $ perl -lane 'print ~~localtime(time-$F[0])' /proc/uptime Or format it however you want, e.g. for ISO8601: $ perl -MPOSIX -lane 'print strftime("%FT%T", localtime(time-$F[0]))' /proc/uptime -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Pr

Re: Finding either boot time or login time

2009-01-30 Thread Fabian Cenedese
>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... Windows does log such events in the system protocol/event log :) But I don't know if you can get this info from cygwin... bye Fabi -- Unsubscrib

Re: Finding either boot time or login time

2009-01-30 Thread Ronald Fischer
Eric Blake 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 t

Re: Finding either boot time or login time

2009-01-30 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Ronald Fischer on 1/30/2009 6:02 AM: > I'm a bit desperate. I'm looking for a way to find EITHER the time the system > was booted, OR the time the last user had logged in, OR the time I had logged > in (of course it would be great if I c