System boot time from C code

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

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

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

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.

: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

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.

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.