File: io_waituntil.c

package info (click to toggle)
libowfat 0.22-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,148 kB
  • ctags: 976
  • sloc: ansic: 10,424; makefile: 42
file content (17 lines) | stat: -rw-r--r-- 373 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "io_internal.h"
#include "safemult.h"

void io_waituntil(tai6464 t) {
  uint64 x,y;
  tai6464 now,diff;
  taia_now(&now);
  if (taia_less(&t,&now))
    y=0;
  else {
    taia_sub(&diff,&t,&now);
    if (!umult64(diff.sec.x,1000,&x) || (y=x+diff.nano/1000000)<x)
      y=-1;	/* overflow; wait indefinitely */
    if (!y && diff.nano) y=1;
  }
  io_waituntil2(y);
}