Skip to content

Commit

Permalink
convert ntp time to unix time
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Dec 28, 2012
1 parent 56c281c commit d0d613d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Stream.hs
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ toMessage s change ticks (o, m) =
logicalNow = (logicalTime change beat)
beat' = (fromIntegral ticks + 1) / fromIntegral tpb
logicalPeriod = (logicalTime change (beat + 1)) - logicalNow
logicalOnset = logicalNow + (logicalPeriod * o) + latency
logicalOnset = ntpr_to_ut $ logicalNow + (logicalPeriod * o) + latency
sec = floor logicalOnset
usec = floor $ 1000000 * (logicalOnset - (fromIntegral sec))
oscdata = catMaybes $ mapMaybe (\x -> Map.lookup x m') (params s)
oscdata' = ((Int sec):(Int usec):oscdata)
osc | timestamp s = Bundle (immediately) [Message (path s) oscdata']
| otherwise = Bundle (UTCr logicalOnset) [Message (path s) oscdata]
| otherwise = Bundle (immediately) [Message (path s) oscdata]
return osc


Expand Down

0 comments on commit d0d613d

Please sign in to comment.