Comment by coldtea

6 years ago

>And nothing else on that page apart from that it's UInt64.

What else exactly do you need?

It's a reference page for the members of the struct AudioTimeSTamp:

https://developer.apple.com/documentation/coreaudiotypes/aud...

I wish many C/C++ libs had such a good documentation...

> What else exactly do you need?

What unit it reflects. What epoch it uses. When does it wraparound? Is it realtime? Or best guess? Is it wall-clock like CLOCK_REALTIME or is closer to CLOCK_MONOTONIC? Is a valid range the entirety of possible uint64 values, or is there a range limit?

  • The answer is “not applicable” to all of these. The word clock is unit less, just ticking up each sample. It’s not actually a clock in the normal sense, there is no leap years or anything in it. It’s used to synchronize devices.

    Granted, the documentation isn’t the best at explaining it. But if you know what a word clock is in terms of audio, you know what the value is; a counter.

    • > The word clock is unit less, just ticking up each sample.

      That should be in the documentation. Each sample is guaranteed to have an increment compared to a previous sample.

      But, it doesn't answer all of the questions.

      Does the world clock always start from 0? Is that an assumption that can be made?

      Or is the valid range anywhere inside a uint64?

      What happens if the number of samples exceeds the length of the world clock unit? Is it allowed to overflow? In which case it violates the assumption that it always just increments.

      5 replies →

    • There is a glossary in the CoreAudio docs, but it hasn't been updated since 2010. And it doesn't include an entry for WordClock.

      You could argue that generally the docs are good enough to Get Shit Done. And people are Getting Shit Done on the platform as a whole. So there's no problem.

      But it's a shame Apple doesn't consider better docs a priority. IMO it's not a good look for a trillion dollar company.

      More, I don't know if insiders use the same doc base. If so it's definitely wasteful, because newcomers are going to be wasting time and effort trying to get up to speed.

> What else exactly do you need?

I always like to know the units (seconds? nanoseconds?) and the reference-year (1970? 2001? 1601?)

  • Also, how are leap seconds reflect in this value if at all?

    Apple should look at linux's manpage on the `time` syscall for inspiration.