Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
benchmark
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
benchmark
Commits
5e77de62
Commit
5e77de62
authored
Mar 02, 2015
by
Eric
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #76 from google/64-32
One more 64-bit to 32-bit conversion
parents
11488610
2789aba1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
4 deletions
+3
-4
sleep.cc
src/sleep.cc
+3
-3
sleep.h
src/sleep.h
+0
-1
No files found.
src/sleep.cc
View file @
5e77de62
...
...
@@ -25,7 +25,7 @@ void SleepForSeconds(double seconds) {
SleepForMilliseconds
(
static_cast
<
int
>
(
kNumMillisPerSecond
*
seconds
));
}
#else // OS_WINDOWS
void
SleepForMicroseconds
(
int
64_t
microseconds
)
{
void
SleepForMicroseconds
(
int
microseconds
)
{
struct
timespec
sleep_time
;
sleep_time
.
tv_sec
=
microseconds
/
kNumMicrosPerSecond
;
sleep_time
.
tv_nsec
=
(
microseconds
%
kNumMicrosPerSecond
)
*
kNumNanosPerMicro
;
...
...
@@ -34,11 +34,11 @@ void SleepForMicroseconds(int64_t microseconds) {
}
void
SleepForMilliseconds
(
int
milliseconds
)
{
SleepForMicroseconds
(
static_cast
<
int
64_t
>
(
milliseconds
)
*
kNumMicrosPerMilli
);
SleepForMicroseconds
(
static_cast
<
int
>
(
milliseconds
)
*
kNumMicrosPerMilli
);
}
void
SleepForSeconds
(
double
seconds
)
{
SleepForMicroseconds
(
static_cast
<
int
64_t
>
(
seconds
*
kNumMicrosPerSecond
));
SleepForMicroseconds
(
static_cast
<
int
>
(
seconds
*
kNumMicrosPerSecond
));
}
#endif // OS_WINDOWS
}
// end namespace benchmark
src/sleep.h
View file @
5e77de62
...
...
@@ -10,7 +10,6 @@ const int64_t kNumMicrosPerSecond = kNumMillisPerSecond * 1000LL;
const
int64_t
kNumNanosPerMicro
=
1000LL
;
const
int64_t
kNumNanosPerSecond
=
kNumNanosPerMicro
*
kNumMicrosPerSecond
;
void
SleepForMicroseconds
(
int64_t
microseconds
);
void
SleepForMilliseconds
(
int
milliseconds
);
void
SleepForSeconds
(
double
seconds
);
}
// end namespace benchmark
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment