-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with std::chrono with libc++ in armv7 #618
Comments
This could be related to #423 (comment). Check if the value is correct for armv7 with target API 21. |
How does it fail? I can't reproduce a problem here. AFAICT, steady_clock::time_point
steady_clock::now() _NOEXCEPT
{
struct timespec tp;
if (0 != clock_gettime(CLOCK_MONOTONIC, &tp))
__throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC) failed");
return time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
} This code works fine: #include <chrono>
#include <stdint.h>
#include <stdio.h>
unsigned long long time_posix() {
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
return( ((int64_t)now.tv_sec * 1000000000L) + now.tv_nsec );
}
unsigned long long time_cxx() {
return std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::steady_clock::now().time_since_epoch()).count();
}
int main() {
printf("%llu\n", time_posix());
printf("%llu\n", time_cxx());
}
NDK Version: r16b |
Closing since we couldn't repro. Will reopen if we get a failing test case. |
I know this is not a proper bug report but I wanted to report that we found an issue with the following configuration:
NDK: 16b
Arch: armv7
STL: libc++
Code:
std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now().time_since_epoch()).count()
This used to work, and basically gave the same information as
Since moving to libc++, it doesn't work as expected anymore.
Replacing the "std::" code with the "clock_gettime" solves the issue.
It's still working fine in aarch64.
Sorry, I didn't actually digged deeper to get to the bottom of it, as I personally wanted to get rid of the std::chrono construct anyways ;)
The text was updated successfully, but these errors were encountered: