Page MenuHomePhabricator

[libc++][chrono] Fixes formatter duration.
Needs ReviewPublic

Authored by Mordante on Nov 28 2022, 8:35 AM.

Details

Reviewers
EricWF
Group Reviewers
Restricted Project
Summary

@EricWF spotted this issue in the post-commit review comments of
D134742. However the suggestion to just use chrono calculations can
result in similar issues when using small fractional seconds.

Diff Detail

Unit TestsFailed

TimeTest
1,500,020 mslibcxx CI Apple back-deployment macosx11.0 arm64 > apple-libc++-backdeployment-cfg-in.std/thread/thread_condition::notify_all_at_thread_exit_lwg3343.pass.cpp
Script: -- : 'COMPILED WITH'; /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ /Users/libcxx-buildkite-agent/libcxx.buildkite-agent/builds/f1-1-macminivault-com/llvm-project/libcxx-ci/libcxx/test/std/thread/thread.condition/notify_all_at_thread_exit_lwg3343.pass.cpp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk --target=arm64-apple-macosx11.0 -nostdinc++ -I /Users/libcxx-buildkite-agent/libcxx.buildkite-agent/builds/f1-1-macminivault-com/llvm-project/libcxx-ci/build/apple-system-backdeployment-11.0/include/c++/v1 -I /Users/libcxx-buildkite-agent/libcxx.buildkite-agent/builds/f1-1-macminivault-com/llvm-project/libcxx-ci/libcxx/test/support -std=c++2b -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-noexcept-type -Wno-atomic-alignment -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -nostdlib++ -L /Users/libcxx-buildkite-agent/libcxx.buildkite-agent/builds/f1-1-macminivault-com/llvm-project/libcxx-ci/build/apple-system-backdeployment-11.0/lib -lc++ -o /Users/libcxx-buildkite-agent/libcxx.buildkite-agent/builds/f1-1-macminivault-com/llvm-project/libcxx-ci/build/apple-system-backdeployment-11.0/test/std/thread/thread.condition/Output/notify_all_at_thread_exit_lwg3343.pass.cpp.dir/t.tmp.exe
1,499,990 mslibcxx CI Apple back-deployment with assertions enabled > apple-libc++-backdeployment-cfg-in.std/thread/thread_condition::notify_all_at_thread_exit_lwg3343.pass.cpp
Script: -- : 'COMPILED WITH'; /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ /Users/libcxx-buildkite-agent/libcxx.buildkite-agent/builds/w4-4macminivaultcom-local/llvm-project/libcxx-ci/libcxx/test/std/thread/thread.condition/notify_all_at_thread_exit_lwg3343.pass.cpp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk --target=arm64-apple-macosx11.0 -nostdinc++ -I /Users/libcxx-buildkite-agent/libcxx.buildkite-agent/builds/w4-4macminivaultcom-local/llvm-project/libcxx-ci/build/apple-system-backdeployment-assertions-11.0/include/c++/v1 -I /Users/libcxx-buildkite-agent/libcxx.buildkite-agent/builds/w4-4macminivaultcom-local/llvm-project/libcxx-ci/libcxx/test/support -std=c++2b -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-noexcept-type -Wno-atomic-alignment -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_ASSERTIONS=1 -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -nostdlib++ -L /Users/libcxx-buildkite-agent/libcxx.buildkite-agent/builds/w4-4macminivaultcom-local/llvm-project/libcxx-ci/build/apple-system-backdeployment-assertions-11.0/lib -lc++ -o /Users/libcxx-buildkite-agent/libcxx.buildkite-agent/builds/w4-4macminivaultcom-local/llvm-project/libcxx-ci/build/apple-system-backdeployment-assertions-11.0/test/std/thread/thread.condition/Output/notify_all_at_thread_exit_lwg3343.pass.cpp.dir/t.tmp.exe

Event Timeline

Mordante created this revision.Nov 28 2022, 8:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 28 2022, 8:35 AM
Mordante requested review of this revision.Nov 28 2022, 8:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 28 2022, 8:35 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
mclow.lists added inline comments.
libcxx/test/std/time/time.syn/formatter.duration.pass.cpp
1095

Are you sure this number shouldn't be 65'535 (aka 0FFFF)?

Wouldn't it be better to write them all in hex, so it's clear what they're represententing?

Mordante updated this revision to Diff 478645.Nov 29 2022, 10:58 AM

Addresses review comments.

Mordante marked an inline comment as done.Nov 29 2022, 11:57 AM
Mordante added inline comments.
libcxx/test/std/time/time.syn/formatter.duration.pass.cpp
1095

Good catch, I've applied your suggestion.

ldionne added a subscriber: ldionne.Dec 6 2022, 9:33 AM

Deferring approval to @EricWF.

hiraditya added inline comments.
libcxx/include/__chrono/convert_to_tm.h
95

nit: tabs

Mordante updated this revision to Diff 489220.Sat, Jan 14, 3:35 AM
Mordante marked an inline comment as done.

Rebased and addresses review comments.

Mordante marked an inline comment as done.Sat, Jan 14, 3:49 AM