X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=regress%2Fhplayback.c.m4;h=dd98f0ec0b8bf1df4172286ebecfd07232318614;hb=HEAD;hp=4ab05c1e285178787b14e7f98e3afa77de908eff;hpb=3c8ca8df3ec5c3dac2ba87729dc321712e5a4e53;p=adns.git diff --git a/regress/hplayback.c.m4 b/regress/hplayback.c.m4 index 4ab05c1..7e688bf 100644 --- a/regress/hplayback.c.m4 +++ b/regress/hplayback.c.m4 @@ -2,12 +2,8 @@ m4_dnl hplayback.c.m4 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 @@ -170,19 +166,25 @@ static int Perrno(const char *stuff) { 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"); } @@ -265,6 +267,7 @@ static void Ppollfds(struct pollfd *fds, int nfds) { 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= ", ";