aboutsummaryrefslogtreecommitdiff
path: root/osc/packOSC.c
diff options
context:
space:
mode:
authorMartin Peach <mrpeach@users.sourceforge.net>2007-07-11 17:34:38 +0000
committerMartin Peach <mrpeach@users.sourceforge.net>2007-07-11 17:34:38 +0000
commitede66ad78a3c06557c53b2c0b6ee014aa3418e03 (patch)
tree5e040d57f42f3ec3c4f826cd227885e04998221a /osc/packOSC.c
parentb46366d420af97d820fb72a0e7cf34b38ca9edc0 (diff)
unpackOSC now simply outputs (through the right outlet) a delay in milliseconds when it
receives a timetag, as the timetag itself is not useable inside pd. The delay is zero when the timetag is in the past. Help patches have been updated to match. Also corrected a mistake in packOSC.c timetag calculation. svn path=/trunk/externals/mrpeach/; revision=8008
Diffstat (limited to 'osc/packOSC.c')
-rwxr-xr-xosc/packOSC.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/osc/packOSC.c b/osc/packOSC.c
index f609d64..ce73277 100755
--- a/osc/packOSC.c
+++ b/osc/packOSC.c
@@ -1281,12 +1281,13 @@ static OSCTimeTag OSCTT_CurrentTimePlusOffset(uint4 offset)
(unsigned) (tz.tz_dsttime ? 3600 : 0)+
(unsigned) offset/onemillion;
/* Now get the fractional part. */
- tt.fraction = ((unsigned) tv.tv_usec + (unsigned)(offset%onemillion)) * (unsigned) TWO_TO_THE_32_OVER_ONE_MILLION;
+ tt.fraction = (unsigned) tv.tv_usec + (unsigned)(offset%onemillion); /* in usec */
if (tt.fraction > onemillion)
{
tt.fraction -= onemillion;
tt.seconds++;
}
+ tt.fraction *= (unsigned) TWO_TO_THE_32_OVER_ONE_MILLION; /* convert usec to 32-bit fraction of 1 sec */
return tt;
}