Search
Project
General
Profile
Sign in
Register
Home
Projects
Redmine shortcuts
Search
:
ARM9 Based QNX Platforms
All Projects
Mity CPU Platforms
»
ARM9 Based QNX Platforms
Overview
Activity
News
Documents
Wiki
Forums
Download (899 Bytes)
ClockPeriod
ยป clock_period.cpp
Rob Gillis, 10/11/2011 05:08 PM
//============================================================================
// Name : clock_period.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include
<iostream>
#include
<stdlib.h>
#include
<sys/neutrino.h>
using
namespace
std
;
int
main
(
int
argc
,
char
*
argv
[])
{
struct
_clockperiod
clkper
;
if
(
argc
!=
1
&&
argc
!=
2
)
{
cout
<<
"Usage: clock_period <nsec>"
<<
endl
;
exit
(
0
);
}
if
(
argc
==
1
)
{
/* display the current clock period */
ClockPeriod
(
CLOCK_REALTIME
,
NULL
,
&
clkper
,
0
);
cout
<<
"ClockPeriod: "
<<
clkper
.
nsec
<<
" nsecs"
<<
endl
;
}
else
{
/* set new clock period */
clkper
.
nsec
=
atoi
(
argv
[
1
]);
clkper
.
fract
=
0
;
ClockPeriod
(
CLOCK_REALTIME
,
&
clkper
,
NULL
,
0
);
}
return
0
;
}
(1-1/1)
Go to top
Loading...