Browse Source

*duh* one extra zero

master
Felix von Leitner 17 years ago
parent
commit
e119e542a9
3 changed files with 17 additions and 7 deletions
  1. +8
    -2
      GNUmakefile
  2. +8
    -4
      io/io_waituntil.c
  3. +1
    -1
      io_internal.h

+ 8
- 2
GNUmakefile View File

@ -27,12 +27,18 @@ path = $(subst :, ,$(PATH))
diet_path = $(foreach dir,$(path),$(wildcard $(dir)/diet))
ifeq ($(strip $(diet_path)),)
ifneq ($(wildcard /opt/diet/bin/diet),)
DIET=/opt/diet/bin/diet -Os
DIET=/opt/diet/bin/diet
else
DIET=
endif
else
DIET:=$(strip $(diet_path)) -Os
DIET:=$(strip $(diet_path))
endif
ifneq ($(DIET),)
ifneq ($(DEBUG),1)
DIET+=-Os
endif
endif
# to build without diet libc support, use $ make DIET=
# see http://www.fefe.de/dietlibc/ for details about the diet libc


+ 8
- 4
io/io_waituntil.c View File

@ -5,9 +5,13 @@ void io_waituntil(tai6464 t) {
uint64 x,y;
tai6464 now,diff;
taia_now(&now);
taia_sub(&diff,&t,&now);
if (!umult64(diff.sec.x,1000,&x) || (y=x+diff.nano/10000000)<x)
y=-1; /* overflow; wait indefinitely */
if (!y && diff.nano) y=1;
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);
}

+ 1
- 1
io_internal.h View File

@ -15,13 +15,13 @@ extern HANDLE io_comport;
#endif
typedef struct {
tai6464 timeout;
unsigned int wantread:1;
unsigned int wantwrite:1;
unsigned int canread:1;
unsigned int canwrite:1;
unsigned int nonblock:1;
unsigned int inuse:1;
tai6464 timeout;
long next_read;
long next_write;
void* cookie;


Loading…
Cancel
Save