libcm is a C development framework with an emphasis on audio signal processing applications.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cmTime.h 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //{ { label:cmTime
  2. // kw: [ time ] }
  3. //
  4. //(
  5. // This interface is used to read the systems high resolution timer and
  6. // calculate elapsed time.
  7. //)
  8. #ifndef cmTime_h
  9. #define cmTime_h
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. //(
  14. typedef struct timespec cmTimeSpec_t;
  15. /*
  16. get the time
  17. */
  18. void cmTimeGet( cmTimeSpec_t* t );
  19. // Return the elapsed time (t1 - t0) in microseconds
  20. // t1 is assumed to be at a later time than t0.
  21. unsigned cmTimeElapsedMicros( const cmTimeSpec_t* t0, const cmTimeSpec_t* t1 );
  22. // Same as cmTimeElapsedMicros() but the times are not assumed to be ordered.
  23. // The function therefore begins by swapping t1 and t0 if t0 is after t1.
  24. unsigned cmTimeAbsElapsedMicros( const cmTimeSpec_t* t0, const cmTimeSpec_t* t1 );
  25. // Same as cmTimeElapsedMicros() but returns a negative value if t0 is after t1.
  26. int cmTimeDiffMicros( const cmTimeSpec_t* t0, const cmTimeSpec_t* t1 );
  27. // Returns true if t0 <= t1.
  28. bool cmTimeIsLTE( const cmTimeSpec_t* t0, const cmTimeSpec_t* t1 );
  29. // Return true if t0 >= t1.
  30. bool cmTimeIsGTE( const cmTimeSpec_t* t0, const cmTimeSpec_t* t1 );
  31. bool cmTimeIsEqual( const cmTimeSpec_t* t0, const cmTimeSpec_t* t1 );
  32. bool cmTimeIsZero( const cmTimeSpec_t* t0 );
  33. void cmTimeSetZero( cmTimeSpec_t* t0 );
  34. //)
  35. //}
  36. #ifdef __cplusplus
  37. }
  38. #endif
  39. #endif