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
5d5e3790
Commit
5d5e3790
authored
Jan 20, 2012
by
Aurelio Colosimo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix timer handling when timestamp is changed
parent
b74e7a03
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
4 deletions
+28
-4
posix-io.c
arch-gnu-linux/posix-io.c
+11
-2
posix-timer.c
arch-gnu-linux/posix-timer.c
+9
-0
pptp.h
include/pptp/pptp.h
+5
-1
servo.c
proto-standard/servo.c
+3
-1
No files found.
arch-gnu-linux/posix-io.c
View file @
5d5e3790
...
...
@@ -47,16 +47,25 @@ void pp_get_tstamp(TimeInternal *t)
t
->
nanoseconds
=
tp
.
tv_nsec
;
}
void
pp_set_tstamp
(
TimeInternal
*
t
)
int32_t
pp_set_tstamp
(
TimeInternal
*
t
)
{
/* FIXME: what happens with timers? */
struct
timespec
tp_orig
;
struct
timespec
tp
;
if
(
clock_gettime
(
CLOCK_REALTIME
,
&
tp_orig
)
<
0
)
{
/* FIXME diag PERROR("clock_gettime() failed, exiting."); */
exit
(
0
);
}
tp
.
tv_sec
=
t
->
seconds
;
tp
.
tv_nsec
=
t
->
nanoseconds
;
if
(
clock_settime
(
CLOCK_REALTIME
,
&
tp
)
<
0
)
{
/* FIXME diag PERROR("clock_settime() failed, exiting."); */
exit
(
0
);
}
return
tp
.
tv_sec
-
tp_orig
.
tv_sec
;
/* handle only sec field, since
* timer granularity is 1s */
}
int
pp_adj_freq
(
Integer32
adj
)
...
...
arch-gnu-linux/posix-timer.c
View file @
5d5e3790
...
...
@@ -74,6 +74,15 @@ extern int posix_timer_expired(struct pp_timer *tm)
return
0
;
}
extern
void
pp_timer_adjust_all
(
struct
pp_instance
*
ppi
,
int32_t
diff
)
{
int
i
;
for
(
i
=
0
;
i
<
PP_TIMER_ARRAY_SIZE
;
i
++
)
{
ppi
->
timers
[
i
]
+=
diff
;
}
}
int
pp_timer_init
(
struct
pp_instance
*
ppi
)
__attribute__
((
alias
(
"posix_timer_init"
)));
...
...
include/pptp/pptp.h
View file @
5d5e3790
...
...
@@ -250,6 +250,9 @@ extern int pp_timer_init(struct pp_instance *ppi); /* initializes timer common
extern
int
pp_timer_start
(
uint32_t
interval
,
struct
pp_timer
*
tm
);
extern
int
pp_timer_stop
(
struct
pp_timer
*
tm
);
extern
int
pp_timer_expired
(
struct
pp_timer
*
tm
);
/* returns 1 when expired */
/* pp_adj_timers is called after pp_set_tstamp and must be defined for those
* platform who rely on system timestamp for timer expiration handling */
extern
void
pp_timer_adjust_all
(
struct
pp_instance
*
ppi
,
int32_t
diff
);
/* Servo */
extern
void
pp_init_clock
(
struct
pp_instance
*
ppi
);
...
...
@@ -324,7 +327,8 @@ extern void set_TimeInternal(TimeInternal *t, Integer32 s, Integer32 ns);
/* Get and Set system timestamp */
extern
void
pp_get_tstamp
(
TimeInternal
*
t
);
extern
void
pp_set_tstamp
(
TimeInternal
*
t
);
extern
int32_t
pp_set_tstamp
(
TimeInternal
*
t
);
/* Virtualization of Linux adjtimex (or BSD adjtime) system clock time
* adjustment. Boolean: returns 1 in case of success and 0 if failure */
...
...
proto-standard/servo.c
View file @
5d5e3790
...
...
@@ -259,6 +259,7 @@ void pp_update_clock(struct pp_instance *ppi)
{
Integer32
adj
;
TimeInternal
time_tmp
;
uint32_t
tstamp_diff
;
/* FIXME diag DBGV("updateClock\n");*/
...
...
@@ -290,7 +291,8 @@ void pp_update_clock(struct pp_instance *ppi)
pp_get_tstamp
(
&
time_tmp
);
sub_TimeInternal
(
&
time_tmp
,
&
time_tmp
,
&
DSCUR
(
ppi
)
->
offsetFromMaster
);
pp_set_tstamp
(
&
time_tmp
);
tstamp_diff
=
pp_set_tstamp
(
&
time_tmp
);
pp_timer_adjust_all
(
ppi
,
tstamp_diff
);
pp_init_clock
(
ppi
);
}
else
{
adj
=
DSCUR
(
ppi
)
->
offsetFromMaster
.
nanoseconds
...
...
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