Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
220443f8
Commit
220443f8
authored
Jul 16, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add "clock_t_to_jiffies()" conversion function with
some rather minimal overflow protection.
parent
faa3c778
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
include/linux/times.h
include/linux/times.h
+20
-0
No files found.
include/linux/times.h
View file @
220443f8
...
...
@@ -11,6 +11,26 @@
# define jiffies_to_clock_t(x) ((clock_t) jiffies_64_to_clock_t((u64) x))
#endif
static
inline
unsigned
long
clock_t_to_jiffies
(
unsigned
long
x
)
{
#if (HZ % USER_HZ)==0
if
(
x
>=
~
0UL
/
(
HZ
/
USER_HZ
))
return
~
0UL
;
return
x
*
(
HZ
/
USER_HZ
);
#else
u64
jif
;
/* Don't worry about loss of precision here .. */
if
(
x
>=
~
0UL
/
HZ
*
USER_HZ
)
return
~
0UL
;
/* .. but do try to contain it here */
jif
=
x
*
(
u64
)
HZ
;
do_div
(
jif
,
USER_HZ
);
return
jif
;
#endif
}
static
inline
u64
jiffies_64_to_clock_t
(
u64
x
)
{
#if (HZ % USER_HZ)==0
...
...
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