Lines Matching +full:tx +full:- +full:sec
9 * kernel's leap-second behavior, as well as how well applications
10 * handle the leap-second discontinuity.
12 * Usage: leap-a-day [-s] [-i <num>]
15 * -s: Each iteration, set the date to 10 seconds before midnight GMT.
21 * -i: Number of iterations to run (default: infinite)
27 * $ gcc leap-a-day.c -o leap-a-day -lrt
75 ts.tv_nsec -= NSEC_PER_SEC; in timespec_add()
97 struct timex tx; in clear_time_state() local
103 * -stable), had an issue with the state machine in clear_time_state()
106 tx.modes = ADJ_STATUS; in clear_time_state()
107 tx.status = STA_PLL; in clear_time_state()
108 ret = adjtimex(&tx); in clear_time_state()
111 tx.modes = ADJ_MAXERROR; in clear_time_state()
112 tx.maxerror = 0; in clear_time_state()
113 ret = adjtimex(&tx); in clear_time_state()
116 tx.modes = ADJ_STATUS; in clear_time_state()
117 tx.status = 0; in clear_time_state()
118 ret = adjtimex(&tx); in clear_time_state()
123 /* Make sure we cleanup on ctrl-c */
132 struct timex tx; in sigalarm() local
135 tx.modes = 0; in sigalarm()
136 ret = adjtimex(&tx); in sigalarm()
138 if (tx.time.tv_sec < next_leap) { in sigalarm()
141 printf("adjtimex: %10ld sec + %6ld us (%i)\t%s\n", in sigalarm()
142 tx.time.tv_sec, in sigalarm()
143 tx.time.tv_usec, in sigalarm()
144 tx.tai, in sigalarm()
150 printf("adjtimex: %10ld sec + %6ld us (%i)\t%s\n", in sigalarm()
151 tx.time.tv_sec, in sigalarm()
152 tx.time.tv_usec, in sigalarm()
153 tx.tai, in sigalarm()
189 while ((opt = getopt(argc, argv, "sti:")) != -1) { in main()
192 …printf("Only setting leap-flag, not changing time. It could take up to a day for leap to trigger.\… in main()
202 printf("Usage: %s [-w] [-i <iterations>]\n", argv[0]); in main()
203 printf(" -w: Set flag and wait for leap second each iteration"); in main()
205 printf(" -i: Number of iterations (-1 = infinite, default is 10)\n"); in main()
206 printf(" -t: Print TAI time\n"); in main()
207 exit(-1); in main()
211 /* Make sure TAI support is present if -t was used */ in main()
231 printf("This runs continuously. Press ctrl-c to stop\n"); in main()
233 printf("Running for %i iterations. Press ctrl-c to stop\n", iterations); in main()
239 struct timex tx; in main() local
247 next_leap += 86400 - (next_leap % 86400); in main()
252 tv.tv_sec = next_leap - 10; in main()
262 tx.modes = ADJ_STATUS; in main()
264 tx.status = STA_INS; in main()
266 tx.status = STA_DEL; in main()
267 ret = adjtimex(&tx); in main()
275 tx.modes = 0; in main()
276 ret = adjtimex(&tx); in main()
277 if (tx.status != STA_INS && tx.status != STA_DEL) { in main()
291 printf("Setting timer for %ld - %s", next_leap, ctime(&next_leap)); in main()
296 if (timer_create(CLOCK_REALTIME, &se, &tm1) == -1) { in main()
307 ts.tv_sec = next_leap - 3; in main()
315 tx.modes = 0; in main()
316 ret = adjtimex(&tx); in main()
317 if (tx.status != STA_INS && tx.status != STA_DEL) { in main()
319 tx.modes = ADJ_STATUS; in main()
321 tx.status = STA_INS; in main()
323 tx.status = STA_DEL; in main()
324 ret = adjtimex(&tx); in main()
328 now = tx.time.tv_sec; in main()
334 tx.modes = 0; in main()
335 ret = adjtimex(&tx); in main()
339 printf("%ld sec, %9ld ns\t%s\n", in main()
344 ctime_r(&tx.time.tv_sec, buf); in main()
345 buf[strlen(buf)-1] = 0; /*remove trailing\n */ in main()
349 tx.time.tv_usec, in main()
350 tx.tai, in main()
353 now = tx.time.tv_sec; in main()
372 if ((iterations != -1) && !(--iterations)) in main()