Skip to content

az_platform_clock_msec POSIX implementation #2364

Open

Description

az_posix.c implements the az_platform_clock_msec by measuring CPU time, not wall time. This API isn't used today.
In ANSI C/POSIX, clock_t clock() is to approximate the CPU time spent in a process and the current naming creates confusion.

A few ways to fix this:

  1. clock_gettime() clock_getres(). The problem is that POSIX doesn't guarantee availability of (all) timing functions. We'll need runtime code to discover enabled functionality.
  2. Use the c time() epoch timer with 1 second accuracy.

Also, please consider the API breaking change to rename the API name to AZ_NODISCARD az_result az_platform_time_msec(int64_t* out_clock_msec) to further reduce confusion on the purpose of the API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Azure.CoreClientThis issue points to a problem in the data-plane of the library.bugThis issue requires a change to an existing behavior in the product in order to be resolved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions