diff options
Diffstat (limited to 'runit-2.1.2/src/taia_sub.c')
-rw-r--r-- | runit-2.1.2/src/taia_sub.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/runit-2.1.2/src/taia_sub.c b/runit-2.1.2/src/taia_sub.c new file mode 100644 index 0000000..d902e50 --- /dev/null +++ b/runit-2.1.2/src/taia_sub.c @@ -0,0 +1,23 @@ +/* Public domain. */ + +#include "taia.h" + +/* XXX: breaks tai encapsulation */ + +void taia_sub(struct taia *t,const struct taia *u,const struct taia *v) +{ + unsigned long unano = u->nano; + unsigned long uatto = u->atto; + + t->sec.x = u->sec.x - v->sec.x; + t->nano = unano - v->nano; + t->atto = uatto - v->atto; + if (t->atto > uatto) { + t->atto += 1000000000UL; + --t->nano; + } + if (t->nano > unano) { + t->nano += 1000000000UL; + --t->sec.x; + } +} |