m4_dnl (part of complex test harness, not of the library)
m4_dnl - playback routines
-m4_dnl This file is part of adns, which is
-m4_dnl Copyright (C) 1997-2000,2003,2006,2014-2016,2020 Ian Jackson
-m4_dnl Copyright (C) 2014 Mark Wooding
-m4_dnl Copyright (C) 1999-2000,2003,2006 Tony Finch
-m4_dnl Copyright (C) 1991 Massachusetts Institute of Technology
-m4_dnl (See the file INSTALL for full details.)
+m4_dnl This file is part of adns, which is Copyright Ian Jackson
+m4_dnl and contributors (see the file INSTALL for full details).
m4_dnl
m4_dnl This program is free software; you can redistribute it and/or modify
m4_dnl it under the terms of the GNU General Public License as published by
static void P_updatetime(void) {
int chars;
- unsigned long sec, usec;
+ unsigned long sec;
+ long usec;
if (!adns__vbuf_ensure(&vb2,1000)) Tnomem();
fgets(vb2.buf,vb2.avail,Tinputfile); Pcheckinput();
chars= -1;
- sscanf(vb2.buf," +%lu.%lu%n",&sec,&usec,&chars);
+ sscanf(vb2.buf," +%lu.%ld%n",&sec,&usec,&chars);
if (chars==-1) Psyntax("update time invalid");
currenttime.tv_sec+= sec;
- currenttime.tv_usec+= usec;
- if (currenttime.tv_usec > 1000000) {
+ usec = (long)currenttime.tv_usec + usec;
+ while (usec < 0) {
+ currenttime.tv_sec--;
+ usec += 1000000;
+ }
+ while (usec > 1000000) {
currenttime.tv_sec++;
- currenttime.tv_usec -= 1000000;
+ usec -= 1000000;
}
+ currenttime.tv_usec = usec;
if (vb2.buf[chars] != hm_squote\nhm_squote) Psyntax("not newline after update time");
}
if (gotevents != fds->events) Psyntax("poll fds[].events changed");
Pstring(", revents=",", revents= in pollfds");
fds->revents= Ppollfdevents();
+ if (gotevents) FR_WRITE(fds->revents);
Pstring("}","} in pollfds");
Pstring(comma,"separator in pollfds");
comma= ", ";