public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Finding either boot time or login time
@ 2009-01-30 15:33 Ronald Fischer
  2009-01-30 15:58 ` Eric Blake
  0 siblings, 1 reply; 12+ messages in thread
From: Ronald Fischer @ 2009-01-30 15:33 UTC (permalink / raw)
  To: cygwin

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 could find all of it, but one of this 
would already be sufficient).

From a past posting to this issue, I got the advice to use the 'last' command, 
but issuing, for instance,

  last

I only get 

  wtmp begins Thu Jan 29 09:22:40 2009

which is the time wtmp has been created (but there was at least one shutdown and
startup after this - why doesn't it show up in wtmp?).

Then I thought I could get this information by sysctl -a, but had to learn that 
this is not implemented.

Any other idea what I could try?

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/

^ permalink raw reply	[flat|nested] 12+ messages in thread
* RE: Finding either boot time or login time
@ 2009-02-02 16:54 Cooper, Karl (US SSA)
  2009-02-02 17:37 ` Owen Rees
  0 siblings, 1 reply; 12+ messages in thread
From: Cooper, Karl (US SSA) @ 2009-02-02 16:54 UTC (permalink / raw)
  To: Jerry D. Hedden, cygwin

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-02-02 20:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-30 15:33 Finding either boot time or login time Ronald Fischer
2009-01-30 15:58 ` Eric Blake
2009-01-30 15:58   ` Ronald Fischer
2009-01-30 16:43     ` Fabian Cenedese
2009-01-30 17:02       ` Mark J. Reed
2009-02-02 14:11         ` Ronald Fischer
2009-02-02 14:34           ` Jerry D. Hedden
2009-02-02 20:28             ` Mark J. Reed
2009-01-30 22:08     ` Brian Mathis
2009-01-30 22:45       ` Owen Rees
2009-02-02 16:54 Cooper, Karl (US SSA)
2009-02-02 17:37 ` Owen Rees

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).