Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
PPSi
Commits
9ef24075
Commit
9ef24075
authored
May 03, 2019
by
Jean-Claude BAU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a rounding value for interval to picos convertion
parent
4fe4f791
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
3 deletions
+3
-3
ieee1588_types.h
include/ppsi/ieee1588_types.h
+1
-1
pp-time.h
include/ppsi/pp-time.h
+1
-1
time-arith.c
lib/time-arith.c
+1
-1
No files found.
include/ppsi/ieee1588_types.h
View file @
9ef24075
...
...
@@ -54,7 +54,7 @@ typedef struct _UInteger64 { /*/* TODO : Should be replaced by UInteger64 */
#define TIME_INTERVAL_FRACBITS 16
#define TIME_INTERVAL_FRACMASK 0xFFFF
#define TIME_INTERVAL_FRACBITS_AS_FLOAT 16.0
#define TIME_INTERVAL_ROUNDING_VALUE (1<<(TIME_INTERVAL_FRACBITS-1))
#define TIME_INTERVAL_ROUNDING_VALUE (
(uint64_t)
1<<(TIME_INTERVAL_FRACBITS-1))
/* Min/max value expressed in picos (int64_t) which can be stored in a TimeInterval type */
#define TIME_INTERVAL_MIN_PICOS_VALUE_AS_INT64 ((int64_t) 0xFE0C000000000000)
...
...
include/ppsi/pp-time.h
View file @
9ef24075
...
...
@@ -4,7 +4,7 @@
#define TIME_FRACBITS 16
#define TIME_FRACMASK 0xFFFF
#define TIME_FRACBITS_AS_FLOAT 16.0
#define TIME_ROUNDING_VALUE (1<<(TIME_FRACBITS-1))
#define TIME_ROUNDING_VALUE (
(uint64_t)
1<<(TIME_FRACBITS-1))
/* Everything internally uses this time format, *signed* */
struct
pp_time
{
...
...
lib/time-arith.c
View file @
9ef24075
...
...
@@ -178,7 +178,7 @@ TimeInterval picos_to_interval(int64_t picos)
int64_t
interval_to_picos
(
TimeInterval
interval
)
{
return
(
interval
*
1000
)
>>
TIME_INTERVAL_FRACBITS
;
return
(
((
interval
*
(
int64_t
)
1000
)
+
TIME_INTERVAL_ROUNDING_VALUE
)
>>
TIME_INTERVAL_FRACBITS
)
;
}
/*
...
...
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