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.

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