Skip to content

Non-monotonic behavior of std::chrono::steady_clock #15380

Description

@Urmeli0815

We use emsdk 2.0.17 and have a function in C++ that uses std::chrono::steady_clock like this:

uint64_t GetNow()
{
	using namespace std::chrono;
	return static_cast<uint64_t>(duration_cast<milliseconds>(steady_clock::now().time_since_epoch()).count());
}

According to the C++-Standard the return value should be a monolitically increasing number, independent of the thread on which it is called. We currently experience problems with non-monotonic behavior between two subsequent GetNow()-Calls on different threads, partially with quite substantial negative differences.

A while ago an issue was fixed in this area: #9783. My question would be if this fix only resolved the problem between the mainthread and a pthread, or should it also resolve it between pthreads?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions