Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
FORMUS3IC_LAS3
/
embb
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f9cb0a92
authored
Mar 07, 2016
by
Marcus Winter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
base_c: fixed checks and documentation in time, duration and log
parent
b9ca6dc9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
14 deletions
+11
-14
base_c/include/embb/base/c/duration.h
+2
-0
base_c/include/embb/base/c/log.h
+1
-0
base_c/include/embb/base/c/time.h
+2
-0
base_c/src/duration.c
+2
-7
base_c/src/log.c
+2
-0
base_c/src/time.c
+2
-7
No files found.
base_c/include/embb/base/c/duration.h
View file @
f9cb0a92
...
...
@@ -249,6 +249,8 @@ int embb_duration_as_seconds(
/**
* Compares two durations.
*
* \pre \c lhs and \c rhs are not NULL and properly initialized.
*
* \return -1 if \c lhs < \c rhs \n
* 0 if \c lhs == \c rhs \n
* 1 if \c lhs > \c rhs
...
...
base_c/include/embb/base/c/log.h
View file @
f9cb0a92
...
...
@@ -67,6 +67,7 @@ typedef void(*embb_log_function_t)(void * context, char const * message);
/**
* Default logging function.
* Writes to the given file (context needs to be a FILE*).
* \pre \c context is not NULL.
* \ingroup C_LOG
* \threadsafe
*/
...
...
base_c/include/embb/base/c/time.h
View file @
f9cb0a92
...
...
@@ -89,6 +89,8 @@ int embb_time_in(
/**
* Compares two time points.
*
* \pre \c lhs and \c rhs are not NULL and properly initialized.
*
* \return -1 if \c lhs < \c rhs \n
* 0 if \c lhs == \c rhs \n
* 1 if \c lhs > \c rhs
...
...
base_c/src/duration.c
View file @
f9cb0a92
...
...
@@ -183,7 +183,6 @@ int embb_duration_as_seconds(const embb_duration_t* duration,
if
(
duration
->
nanoseconds
%
1000000000
>
0
)
{
return
EMBB_UNDERFLOW
;
}
assert
(
duration
->
nanoseconds
%
1000000000
==
0
);
if
(
duration
->
seconds
>
ULLONG_MAX
)
{
return
EMBB_OVERFLOW
;
}
...
...
@@ -193,12 +192,8 @@ int embb_duration_as_seconds(const embb_duration_t* duration,
int
embb_duration_compare
(
const
embb_duration_t
*
lhs
,
const
embb_duration_t
*
rhs
)
{
if
(
lhs
==
NULL
||
rhs
==
NULL
)
{
return
EMBB_ERROR
;
}
if
(
lhs
->
nanoseconds
>=
1000000000
||
rhs
->
nanoseconds
>=
1000000000
)
{
return
EMBB_ERROR
;
}
assert
(
lhs
!=
NULL
&&
rhs
!=
NULL
);
assert
(
lhs
->
nanoseconds
<
1000000000
&&
rhs
->
nanoseconds
<
1000000000
);
if
(
lhs
->
seconds
>
rhs
->
seconds
)
{
return
1
;
}
else
if
(
lhs
->
seconds
<
rhs
->
seconds
)
{
...
...
base_c/src/log.c
View file @
f9cb0a92
...
...
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <assert.h>
#include <embb/base/c/log.h>
...
...
@@ -35,6 +36,7 @@
void
embb_log_write_file
(
void
*
context
,
char
const
*
message
)
{
assert
(
context
!=
NULL
);
FILE
*
ff
=
(
FILE
*
)
context
;
fprintf
(
ff
,
"%s"
,
message
);
fflush
(
ff
);
...
...
base_c/src/time.c
View file @
f9cb0a92
...
...
@@ -33,13 +33,8 @@ void embb_time_now(embb_time_t* time) {
}
int
embb_time_compare
(
const
embb_time_t
*
lhs
,
const
embb_time_t
*
rhs
)
{
if
(
lhs
==
NULL
||
rhs
==
NULL
)
{
return
EMBB_ERROR
;
}
if
(
lhs
->
nanoseconds
>=
1000000000
||
rhs
->
nanoseconds
>=
1000000000
)
{
return
EMBB_ERROR
;
}
assert
(
lhs
!=
NULL
&&
rhs
!=
NULL
);
assert
(
lhs
->
nanoseconds
<
1000000000
&&
rhs
->
nanoseconds
<
1000000000
);
if
(
lhs
->
seconds
>
rhs
->
seconds
)
{
return
1
;
}
else
if
(
lhs
->
seconds
<
rhs
->
seconds
)
{
...
...
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