Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
babeld
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
babeld
Commits
0289c039
Commit
0289c039
authored
Mar 13, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement parse_msec.
parent
3e1e8b9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
util.c
util.c
+42
-0
util.h
util.h
+1
-0
No files found.
util.c
View file @
0289c039
...
...
@@ -133,6 +133,48 @@ timeval_min_sec(struct timeval *d, int secs)
}
}
int
parse_msec
(
const
char
*
string
)
{
unsigned
int
in
,
fl
;
int
i
,
j
;
in
=
fl
=
0
;
i
=
0
;
while
(
string
[
i
]
==
' '
||
string
[
i
]
==
'\t'
)
i
++
;
while
(
string
[
i
]
>=
'0'
&&
string
[
i
]
<=
'9'
)
{
in
=
in
*
10
+
string
[
i
]
-
'0'
;
i
++
;
}
if
(
string
[
i
]
==
'.'
)
{
i
++
;
j
=
0
;
while
(
string
[
i
]
>=
'0'
&&
string
[
i
]
<=
'9'
)
{
fl
=
fl
*
10
+
string
[
i
]
-
'0'
;
i
++
;
j
++
;
}
while
(
j
>
3
)
{
fl
/=
10
;
j
--
;
}
while
(
j
<
3
)
{
fl
*=
10
;
j
++
;
}
}
while
(
string
[
i
]
==
' '
||
string
[
i
]
==
'\t'
)
i
++
;
if
(
string
[
i
]
==
'\0'
)
return
in
*
1000
+
fl
;
return
-
1
;
}
void
do_debugf
(
int
level
,
const
char
*
format
,
...)
{
...
...
util.h
View file @
0289c039
...
...
@@ -36,6 +36,7 @@ int timeval_compare(const struct timeval *s1, const struct timeval *s2)
ATTRIBUTE
((
pure
));
void
timeval_min
(
struct
timeval
*
d
,
const
struct
timeval
*
s
);
void
timeval_min_sec
(
struct
timeval
*
d
,
int
secs
);
int
parse_msec
(
const
char
*
string
);
void
do_debugf
(
int
leve
,
const
char
*
format
,
...)
ATTRIBUTE
((
format
(
printf
,
2
,
3
)));
int
in_prefix
(
const
unsigned
char
*
address
,
...
...
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