Define ANJ_TIME_DURATION_AS_STRING

Define Documentation

ANJ_TIME_DURATION_AS_STRING(duration, unit)

Formats a duration as a string in the given unit.

The macro allocates a temporary stack buffer and returns a pointer to it, making it convenient for logging:

anj_log(my_module, L_DEBUG, "Timeout=%s",
        ANJ_TIME_DURATION_AS_STRING(timeout, ANJ_TIME_UNIT_MS));
Parameters:
  • duration – Duration to format.

  • unit – Unit to print the value in.

Returns:

const char * to a NUL-terminated string valid until the end of the full expression (implementation uses a compound literal).