Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encapsulate the delay ratio #1128

Merged
merged 4 commits into from Feb 7, 2020
Merged

Commits on Feb 2, 2020

  1. Encapsulate the delay ratio

    Two major reasons:
    
    * This avoids the public dependency on `num_ratio`.
    * The internal representation can be changed. This already proved
      necessary once (from u16 rational) and in this manner we are free to
      do it again by adding an inner enum representation.
    
    Note that we already have rounding semantics for the meaning of Delay as
    gif rounds to the nearest 10ms when writing frames. Any more or less
    precise representation can be made to round to the closest u32 ratio.
    HeroicKatora committed Feb 2, 2020
    Copy the full SHA
    22e1fe3 View commit details
    Browse the repository at this point in the history

Commits on Feb 5, 2020

  1. Add conversion of Delay into time::Duration

    With the original available as a millisecond ratio this can easily be
    done to the accuracy of nanoseconds, which is the finest available.
    HeroicKatora committed Feb 5, 2020
    Copy the full SHA
    68ad0cc View commit details
    Browse the repository at this point in the history
  2. Align naming to ratio

    HeroicKatora committed Feb 5, 2020
    Copy the full SHA
    633f247 View commit details
    Browse the repository at this point in the history
  3. Add a saturating conversion from time::Duration

    Given the prior usage, it does not make much sense to provide an exact
    conversion. However, it should be clear that precision is not finite and
    the representation is not exactly that of a Duration.
    
    The implementation turned out to be fairly involved as the num-fraction
    crate does not provide approximation algorithms for fractions. No fear,
    we code them ourselves with extensive testing to cover much more than
    the required accuracy tests.
    HeroicKatora committed Feb 5, 2020
    Copy the full SHA
    b6dacab View commit details
    Browse the repository at this point in the history