System boot time from C code

bridged with qdn.public.qnxrtp.os
Post Reply
Bill Caroselli

System boot time from C code

Post by Bill Caroselli » Mon Nov 17, 2003 4:59 pm

The 'pidin in' utility displays, among other things, the system
boot time.

How can I get this from my own C code?
(I'm looking for a time_t, not an ascii string, if possible.)

Colin Burgess

Re: System boot time from C code

Post by Colin Burgess » Mon Nov 17, 2003 5:45 pm

get the procfs_info.start_time of procnto

Bill Caroselli <qtps@earthlink.net> wrote:
The 'pidin in' utility displays, among other things, the system
boot time.

How can I get this from my own C code?
(I'm looking for a time_t, not an ascii string, if possible.)
--
cburgess@qnx.com

Bill Caroselli

Re: System boot time from C code

Post by Bill Caroselli » Mon Nov 17, 2003 5:54 pm

How do I get procfs_info?

How do I convert from a _Uint64t start_time in nsec to a time_t?
Can I just divide by 1,000,000,000?


Colin Burgess <cburgess@qnx.com> wrote:
CB > get the procfs_info.start_time of procnto

CB > Bill Caroselli <qtps@earthlink.net> wrote:
The 'pidin in' utility displays, among other things, the system
boot time.

How can I get this from my own C code?
(I'm looking for a time_t, not an ascii string, if possible.)

David Gibbs

Re: System boot time from C code

Post by David Gibbs » Mon Nov 17, 2003 6:02 pm

Colin Burgess <cburgess@qnx.com> wrote:
get the procfs_info.start_time of procnto
Hm...might

SYSPAGE_ENTRY(qtime)->boot_time

work as well?

-David
Bill Caroselli <qtps@earthlink.net> wrote:
The 'pidin in' utility displays, among other things, the system
boot time.

How can I get this from my own C code?
(I'm looking for a time_t, not an ascii string, if possible.)
--
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Colin Burgess

Re: System boot time from C code

Post by Colin Burgess » Mon Nov 17, 2003 6:33 pm

:v) Yeah, I guess. Actually, that's what pidin uses. Sorry, Bill.

David Gibbs <dagibbs@qnx.com> wrote:
Colin Burgess <cburgess@qnx.com> wrote:
get the procfs_info.start_time of procnto

Hm...might

SYSPAGE_ENTRY(qtime)->boot_time

work as well?

-David

Bill Caroselli <qtps@earthlink.net> wrote:
The 'pidin in' utility displays, among other things, the system
boot time.

How can I get this from my own C code?
(I'm looking for a time_t, not an ascii string, if possible.)
--
cburgess@qnx.com

--
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.
--
cburgess@qnx.com

David Gibbs

Re: System boot time from C code

Post by David Gibbs » Mon Nov 17, 2003 6:44 pm

Bill Caroselli <qtps@earthlink.net> wrote:
How do I get procfs_info?

How do I convert from a _Uint64t start_time in nsec to a time_t?
Can I just divide by 1,000,000,000?
nsec2timespec() will convert from that to a struct timespec().
struct timespec.tv_sec is a time_t seconds since Jan, 1970.

-David
--
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Bill Caroselli

Re: System boot time from C code

Post by Bill Caroselli » Mon Nov 17, 2003 10:17 pm

David Gibbs <dagibbs@qnx.com> wrote:
DG > Colin Burgess <cburgess@qnx.com> wrote:
get the procfs_info.start_time of procnto
DG > Hm...might

DG > SYSPAGE_ENTRY(qtime)->boot_time

DG > work as well?

DG > -David

Thank you. Works great.

Post Reply

Return to “qdn.public.qnxrtp.os”