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
47
Issues
47
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
58f064cc
Commit
58f064cc
authored
Jan 17, 2012
by
Aurelio Colosimo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pp_get_tstamp and new pp_set_tstamp implemented
parent
0426fd59
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
3 deletions
+23
-3
Makefile
arch-gnu-linux/Makefile
+1
-1
posix-io.c
arch-gnu-linux/posix-io.c
+20
-1
pptp.h
include/pptp/pptp.h
+2
-1
No files found.
arch-gnu-linux/Makefile
View file @
58f064cc
...
...
@@ -21,5 +21,5 @@ all: $(TARGET)
# were not selected yet (e.g., pp_open_instance() ).
$(TARGET)
:
$(TARGET).o $(LIBARCH)
$(CC)
-Wl
,-Map,
$(TARGET)
.map2
-o
$@
$(TARGET)
.o
\
-L
$A
-larch
-L
$D
-lstd
-L
$A
-larch
-L
$D
-lstd
-lrt
arch-gnu-linux/posix-io.c
View file @
58f064cc
...
...
@@ -3,6 +3,7 @@
*/
#define _GNU_SOURCE
/* for strnlen */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <pptp/pptp.h>
...
...
@@ -34,5 +35,23 @@ void *pp_memset(void *s, int c, int count)
void
pp_get_tstamp
(
TimeInternal
*
t
)
{
/*FIXME tstamp *sptr = htonl(time(NULL)); */
struct
timespec
tp
;
if
(
clock_gettime
(
CLOCK_REALTIME
,
&
tp
)
<
0
)
{
/* FIXME diag PERROR("clock_gettime() failed, exiting."); */
exit
(
0
);
}
t
->
seconds
=
tp
.
tv_sec
;
t
->
nanoseconds
=
tp
.
tv_nsec
;
}
void
pp_set_tstamp
(
TimeInternal
*
t
)
{
/* FIXME: what happens with timers? */
struct
timespec
tp
;
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
);
}
}
include/pptp/pptp.h
View file @
58f064cc
...
...
@@ -266,8 +266,9 @@ extern int to_TimeInternal(TimeInternal *internal, Timestamp *external);
extern
void
add_TimeInternal
(
TimeInternal
*
r
,
TimeInternal
*
x
,
TimeInternal
*
y
);
extern
void
sub_TimeInternal
(
TimeInternal
*
r
,
TimeInternal
*
x
,
TimeInternal
*
y
);
/* Get a timestamp */
/* Get a
nd Set system
timestamp */
extern
void
pp_get_tstamp
(
TimeInternal
*
t
);
extern
void
pp_set_tstamp
(
TimeInternal
*
t
);
/*
* The state machine itself is an array of these structures.
...
...
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