* [PATCH net-next 1/2] ptp: Add a command line option in testptp to set a specific PTP time
@ 2014-03-25 11:24 Christian Riesch
2014-03-25 11:46 ` Richard Cochran
2014-03-26 20:44 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Christian Riesch @ 2014-03-25 11:24 UTC (permalink / raw)
To: netdev; +Cc: Richard Cochran, Manfred Rudigier, Christian Riesch
From: Manfred Rudigier <manfred.rudigier@omicron.at>
Signed-off-by: Manfred Rudigier <manfred.rudigier@omicron.at>
Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
---
Documentation/ptp/testptp.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/Documentation/ptp/testptp.c b/Documentation/ptp/testptp.c
index e9eaee6..13bddd5 100644
--- a/Documentation/ptp/testptp.c
+++ b/Documentation/ptp/testptp.c
@@ -131,7 +131,8 @@ static void usage(char *progname)
" -P val enable or disable (val=1|0) the system clock PPS\n"
" -s set the ptp clock time from the system time\n"
" -S set the system time from the ptp clock time\n"
- " -t val shift the ptp clock time by 'val' seconds\n",
+ " -t val shift the ptp clock time by 'val' seconds\n"
+ " -T val set the ptp clock time to 'val' seconds\n",
progname);
}
@@ -172,6 +173,7 @@ int main(int argc, char *argv[])
int perout = -1;
int pin_index = -1, pin_func;
int pps = -1;
+ int seconds = 0;
int settime = 0;
int64_t t1, t2, tp;
@@ -179,7 +181,7 @@ int main(int argc, char *argv[])
progname = strrchr(argv[0], '/');
progname = progname ? 1+progname : argv[0];
- while (EOF != (c = getopt(argc, argv, "a:A:cd:e:f:ghi:k:lL:p:P:sSt:v"))) {
+ while (EOF != (c = getopt(argc, argv, "a:A:cd:e:f:ghi:k:lL:p:P:sSt:T:v"))) {
switch (c) {
case 'a':
oneshot = atoi(optarg);
@@ -234,6 +236,10 @@ int main(int argc, char *argv[])
case 't':
adjtime = atoi(optarg);
break;
+ case 'T':
+ settime = 3;
+ seconds = atoi(optarg);
+ break;
case 'h':
usage(progname);
return 0;
@@ -326,6 +332,16 @@ int main(int argc, char *argv[])
}
}
+ if (settime == 3) {
+ ts.tv_sec = seconds;
+ ts.tv_nsec = 0;
+ if (clock_settime(clkid, &ts)) {
+ perror("clock_settime");
+ } else {
+ puts("set time okay");
+ }
+ }
+
if (extts) {
memset(&extts_request, 0, sizeof(extts_request));
extts_request.index = index;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next 1/2] ptp: Add a command line option in testptp to set a specific PTP time
2014-03-25 11:24 [PATCH net-next 1/2] ptp: Add a command line option in testptp to set a specific PTP time Christian Riesch
@ 2014-03-25 11:46 ` Richard Cochran
2014-03-26 20:44 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Richard Cochran @ 2014-03-25 11:46 UTC (permalink / raw)
To: Christian Riesch; +Cc: netdev, Manfred Rudigier
On Tue, Mar 25, 2014 at 12:24:05PM +0100, Christian Riesch wrote:
> From: Manfred Rudigier <manfred.rudigier@omicron.at>
>
> Signed-off-by: Manfred Rudigier <manfred.rudigier@omicron.at>
> Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
> ---
Acked-by: Richard Cochran <richardcochran@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next 1/2] ptp: Add a command line option in testptp to set a specific PTP time
2014-03-25 11:24 [PATCH net-next 1/2] ptp: Add a command line option in testptp to set a specific PTP time Christian Riesch
2014-03-25 11:46 ` Richard Cochran
@ 2014-03-26 20:44 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-03-26 20:44 UTC (permalink / raw)
To: christian.riesch; +Cc: netdev, richardcochran, manfred.rudigier
From: Christian Riesch <christian.riesch@omicron.at>
Date: Tue, 25 Mar 2014 12:24:05 +0100
> From: Manfred Rudigier <manfred.rudigier@omicron.at>
>
> Signed-off-by: Manfred Rudigier <manfred.rudigier@omicron.at>
> Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-26 20:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-25 11:24 [PATCH net-next 1/2] ptp: Add a command line option in testptp to set a specific PTP time Christian Riesch
2014-03-25 11:46 ` Richard Cochran
2014-03-26 20:44 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).