aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/timers/leap-a-day.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/tools/testing/selftests/timers/leap-a-day.c b/tools/testing/selftests/timers/leap-a-day.c
index 331c4f70d8a1..fb46ad6ac92c 100644
--- a/tools/testing/selftests/timers/leap-a-day.c
+++ b/tools/testing/selftests/timers/leap-a-day.c
@@ -141,27 +141,28 @@ void handler(int unused)
141void sigalarm(int signo) 141void sigalarm(int signo)
142{ 142{
143 struct timex tx; 143 struct timex tx;
144 char buf[26];
145 int ret; 144 int ret;
146 145
147 tx.modes = 0; 146 tx.modes = 0;
148 ret = adjtimex(&tx); 147 ret = adjtimex(&tx);
149 148
150 ctime_r(&tx.time.tv_sec, buf); 149 if (tx.time.tv_sec < next_leap) {
151 buf[strlen(buf)-1] = 0; /*remove trailing\n */ 150 printf("Error: Early timer expiration! (Should be %ld)\n", next_leap);
152 printf("%s + %6ld us (%i)\t%s - TIMER FIRED\n", 151 error_found = 1;
153 buf, 152 printf("adjtimex: %10ld sec + %6ld us (%i)\t%s\n",
153 tx.time.tv_sec,
154 tx.time.tv_usec, 154 tx.time.tv_usec,
155 tx.tai, 155 tx.tai,
156 time_state_str(ret)); 156 time_state_str(ret));
157
158 if (tx.time.tv_sec < next_leap) {
159 printf("Error: Early timer expiration!\n");
160 error_found = 1;
161 } 157 }
162 if (ret != TIME_WAIT) { 158 if (ret != TIME_WAIT) {
163 printf("Error: Incorrect NTP state?\n"); 159 printf("Error: Timer seeing incorrect NTP state? (Should be TIME_WAIT)\n");
164 error_found = 1; 160 error_found = 1;
161 printf("adjtimex: %10ld sec + %6ld us (%i)\t%s\n",
162 tx.time.tv_sec,
163 tx.time.tv_usec,
164 tx.tai,
165 time_state_str(ret));
165 } 166 }
166} 167}
167 168
@@ -297,7 +298,7 @@ int main(int argc, char **argv)
297 printf("Scheduling leap second for %s", ctime(&next_leap)); 298 printf("Scheduling leap second for %s", ctime(&next_leap));
298 299
299 /* Set up timer */ 300 /* Set up timer */
300 printf("Setting timer for %s", ctime(&next_leap)); 301 printf("Setting timer for %ld - %s", next_leap, ctime(&next_leap));
301 memset(&se, 0, sizeof(se)); 302 memset(&se, 0, sizeof(se));
302 se.sigev_notify = SIGEV_SIGNAL; 303 se.sigev_notify = SIGEV_SIGNAL;
303 se.sigev_signo = signum; 304 se.sigev_signo = signum;