[libcxx] r337960 - [libc++] Use __int128_t to represent file_time_type.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 25 20:30:18 PDT 2018


Thank you for the clarification.

On Wed, Jul 25, 2018 at 9:16 PM James Y Knight <jyknight at google.com> wrote:

> As is the case on most modern platforms, the ability to store a high-res
> file timestamp is dependent on the filesystem the file is stored on.
>
> The HFS+ filesystem (used by default before macOS 10.13) stores timestamps
> at a 1-second granularity, and APFS (now the default) at a 1 nanosecond
> granularity.
>
> 1-second granularity is also the norm on many of the supported filesystems
> on Linux as well.
>
> On Wed, Jul 25, 2018 at 10:43 PM Eric Fiselier via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>> Looks like macOS 10.11 only supports a resolution of seconds, but I can't
>> find documentation confirming that.
>>
>> I'll adjust the test.
>>
>> /Eric
>>
>> On Wed, Jul 25, 2018 at 8:33 PM Alex L <arphaman at gmail.com> wrote:
>>
>>> Looks like 'SupportsNanosecondRoundTrip' is set to 0.
>>>
>>> On 25 July 2018 at 19:30, Alex L <arphaman at gmail.com> wrote:
>>>
>>>> Sure,
>>>>
>>>> Standard Error:
>>>>
>>>> --
>>>>
>>>> PRIOR:3
>>>>
>>>> AFTER:0
>>>>
>>>>
>>>> Diff:
>>>>
>>>>
>>>> -    return last_write_time(p) == ft;
>>>>
>>>> +    std::cerr << "PRIOR:" << (long long)ft.time_since_epoch().count()
>>>> << std::endl;
>>>>
>>>> +    auto ft2 = last_write_time(p);
>>>>
>>>> +    std::cerr << "AFTER:" << (long long)ft2.time_since_epoch().count()
>>>> << std::endl;
>>>>
>>>> +    return ft2  == ft;
>>>>
>>>> On 25 July 2018 at 19:20, Eric Fiselier <eric at efcs.ca> wrote:
>>>>
>>>>> Could you tell me what the value of the initial time point, and the
>>>>> resulting one are on this line?
>>>>>
>>>>>
>>>>> https://github.com/llvm-mirror/libcxx/blob/master/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp#L224
>>>>>
>>>>> On Wed, Jul 25, 2018 at 8:17 PM Alex L <arphaman at gmail.com> wrote:
>>>>>
>>>>>> Please let me know if this information is helpful. If not, I'll mark
>>>>>> the test as UNSUPPORTED for darwin for the time being and will create an
>>>>>> internal issue to track the investigation into the OS-specific failure.
>>>>>> Cheers,
>>>>>> Alex
>>>>>>
>>>>>> On 25 July 2018 at 19:12, Alex L <arphaman at gmail.com> wrote:
>>>>>>
>>>>>>> I got the following output on an macOS10.11 machine:
>>>>>>>
>>>>>>> Exit Code: 1
>>>>>>>
>>>>>>> Standard Error:
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> Test Case = file, epoch_time
>>>>>>>
>>>>>>> 0
>>>>>>>
>>>>>>> 0
>>>>>>>
>>>>>>> Test Case = dir, epoch_time
>>>>>>>
>>>>>>> 0
>>>>>>>
>>>>>>> 0
>>>>>>>
>>>>>>> Test Case = file, future_time
>>>>>>>
>>>>>>> In set_last_write_time_dynamic_env_test():455 Assertion
>>>>>>> TEST_CHECK(CompareTime(got_time, TC.new_time)) failed.
>>>>>>>
>>>>>>>     in file:
>>>>>>> /Users/local/llvm/projects/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 1532581924000000000
>>>>>>>
>>>>>>> 1532581924695307000
>>>>>>>
>>>>>>> Test Case = dir, future_time
>>>>>>>
>>>>>>> In set_last_write_time_dynamic_env_test():455 Assertion
>>>>>>> TEST_CHECK(CompareTime(got_time, TC.new_time)) failed.
>>>>>>>
>>>>>>>     in file:
>>>>>>> /Users/local/llvm/projects/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 1532581924000000000
>>>>>>>
>>>>>>> 1532581924695307000
>>>>>>>
>>>>>>> Test Case = file, past_time
>>>>>>>
>>>>>>> In set_last_write_time_dynamic_env_test():455 Assertion
>>>>>>> TEST_CHECK(CompareTime(got_time, TC.new_time)) failed.
>>>>>>>
>>>>>>>     in file:
>>>>>>> /Users/local/llvm/projects/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 1532570860000000000
>>>>>>>
>>>>>>> 1532570860695273000
>>>>>>>
>>>>>>> Test Case = dir, past_time
>>>>>>>
>>>>>>> In set_last_write_time_dynamic_env_test():455 Assertion
>>>>>>> TEST_CHECK(CompareTime(got_time, TC.new_time)) failed.
>>>>>>>
>>>>>>>     in file:
>>>>>>> /Users/local/llvm/projects/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 1532570860000000000
>>>>>>>
>>>>>>> 1532570860695273000
>>>>>>>
>>>>>>> Test Case = file, before_epoch_time
>>>>>>>
>>>>>>> In set_last_write_time_dynamic_env_test():455 Assertion
>>>>>>> TEST_CHECK(CompareTime(got_time, TC.new_time)) failed.
>>>>>>>
>>>>>>>     in file:
>>>>>>> /Users/local/llvm/projects/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> -223000000000
>>>>>>>
>>>>>>> -222000017000
>>>>>>>
>>>>>>> Test Case = dir, before_epoch_time
>>>>>>>
>>>>>>> In set_last_write_time_dynamic_env_test():455 Assertion
>>>>>>> TEST_CHECK(CompareTime(got_time, TC.new_time)) failed.
>>>>>>>
>>>>>>>     in file:
>>>>>>> /Users/local/llvm/projects/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> -223000000000
>>>>>>>
>>>>>>> -222000017000
>>>>>>>
>>>>>>> Test Case = file, just_before_epoch_time
>>>>>>>
>>>>>>> In set_last_write_time_dynamic_env_test():455 Assertion
>>>>>>> TEST_CHECK(CompareTime(got_time, TC.new_time)) failed.
>>>>>>>
>>>>>>>     in file:
>>>>>>> /Users/local/llvm/projects/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> -1000000000
>>>>>>>
>>>>>>> -17000
>>>>>>>
>>>>>>> Test Case = dir, just_before_epoch_time
>>>>>>>
>>>>>>> In set_last_write_time_dynamic_env_test():455 Assertion
>>>>>>> TEST_CHECK(CompareTime(got_time, TC.new_time)) failed.
>>>>>>>
>>>>>>>     in file:
>>>>>>> /Users/local/llvm/projects/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> -1000000000
>>>>>>>
>>>>>>> -17000
>>>>>>>
>>>>>>> In last_write_time_symlink_test():487 Assertion TEST_CHECK(got_time
>>>>>>> == new_time) failed.
>>>>>>>
>>>>>>>     in file:
>>>>>>> /Users/local/llvm/projects/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> In last_write_time_symlink_test():489 Assertion
>>>>>>> TEST_CHECK(CompareTime(LastWriteTime(file), new_time)) failed.
>>>>>>>
>>>>>>>     in file:
>>>>>>> /Users/local/llvm/projects/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Summary for testsuite last_write_time_test_suite:
>>>>>>>
>>>>>>>     7 of 9 test cases passed.
>>>>>>>
>>>>>>>     88 of 98 assertions passed.
>>>>>>>
>>>>>>>     0 unsupported test cases.
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>>
>>>>>>> Compiled test failed unexpectedly!
>>>>>>>
>>>>>>> ********************
>>>>>>>
>>>>>>> Testing Time: 4.43s
>>>>>>>
>>>>>>> ********************
>>>>>>>
>>>>>>> Failing Tests (1):
>>>>>>>
>>>>>>>     libc++ ::
>>>>>>> std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>
>>>>>>>
>>>>>>>   Unexpected Failures: 1
>>>>>>>
>>>>>>> On 25 July 2018 at 18:20, Eric Fiselier <eric at efcs.ca> wrote:
>>>>>>>
>>>>>>>> OK. I also added debug print statements to the test to give more
>>>>>>>> information. I'm just waiting for the bots to cycle now.
>>>>>>>>
>>>>>>>> On Wed, Jul 25, 2018 at 7:18 PM Alex L <arphaman at gmail.com> wrote:
>>>>>>>>
>>>>>>>>> I couldn't reproduce it on my machine, and I don't have access to
>>>>>>>>> the bot ATM, but I will try it on an older OS to see if it's an issue with
>>>>>>>>> the particular OS that's used on our bot.
>>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>> Alex
>>>>>>>>>
>>>>>>>>> On 25 July 2018 at 17:43, Alex L <arphaman at gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> I'll take a look and will try to reproduce it right now.
>>>>>>>>>>
>>>>>>>>>> On 25 July 2018 at 17:37, Eric Fiselier <eric at efcs.ca> wrote:
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Wed, Jul 25, 2018 at 6:03 PM Alex L <arphaman at gmail.com>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hmm, looks like the added test is failing on Darwin even after
>>>>>>>>>>>> your fixes.
>>>>>>>>>>>>
>>>>>>>>>>>> Do you have an idea of why that could be?
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Not yet, working on it now.
>>>>>>>>>>> I'm failing to reproduce it on my macbook though. If you can,
>>>>>>>>>>> any information about what's going on would be helpful.
>>>>>>>>>>> Like what are those actual values?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> http://lab.llvm.org:8080/green/job/libcxx_master_cmake/4784/testReport/junit/libc++/std_experimental_filesystem_fs_op_funcs_fs_op_last_write_time/last_write_time_pass_cpp/
>>>>>>>>>>>>
>>>>>>>>>>>> Compiled With:
>>>>>>>>>>>> ['/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++',
>>>>>>>>>>>> '-o',
>>>>>>>>>>>> '/Users/buildslave/jenkins/sharedspace/libcxx/build/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/Output/last_write_time.pass.cpp.o',
>>>>>>>>>>>> '-x', 'c++',
>>>>>>>>>>>> '/Users/buildslave/jenkins/sharedspace/libcxx/libcxx.src/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp',
>>>>>>>>>>>> '-c', '-v', '-arch', 'x86_64', '-mmacosx-version-min=10.13',
>>>>>>>>>>>> '-D_LIBCPP_DISABLE_AVAILABILITY', '-ftemplate-depth=270',
>>>>>>>>>>>> '-Werror=thread-safety', '-std=c++11', '-include',
>>>>>>>>>>>> '/Users/buildslave/jenkins/sharedspace/libcxx/libcxx.src/test/support/nasty_macros.hpp',
>>>>>>>>>>>> '-nostdinc++',
>>>>>>>>>>>> '-I/Users/buildslave/jenkins/sharedspace/libcxx/libcxx.src/include',
>>>>>>>>>>>> '-I/Users/buildslave/jenkins/sharedspace/libcxx/build/include/c++build',
>>>>>>>>>>>> '-isysroot',
>>>>>>>>>>>> '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk',
>>>>>>>>>>>> '-I/Users/buildslave/jenkins/sharedspace/libcxx/libcxx.src/test/support',
>>>>>>>>>>>> '-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="/Users/buildslave/jenkins/sharedspace/libcxx/libcxx.src/test/std/experimental/filesystem/Inputs/static_test_env"',
>>>>>>>>>>>> '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="/Users/buildslave/jenkins/sharedspace/libcxx/build/test/filesystem/Output/dynamic_env"',
>>>>>>>>>>>> '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="/usr/local/opt/python at 2/bin/python2.7
>>>>>>>>>>>> /Users/buildslave/jenkins/sharedspace/libcxx/libcxx.src/test/support/filesystem_dynamic_test_helper.py"',
>>>>>>>>>>>> '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', '-Wextra', '-Werror',
>>>>>>>>>>>> '-Wuser-defined-warnings', '-Wshadow', '-Wno-unused-command-line-argument',
>>>>>>>>>>>> '-Wno-attributes', '-Wno-pessimizing-move', '-Wno-c++11-extensions',
>>>>>>>>>>>> '-Wno-user-defined-literals', '-Wno-noexcept-type',
>>>>>>>>>>>> '-Wno-aligned-allocation-unavailable', '-Wsign-compare',
>>>>>>>>>>>> '-Wunused-variable', '-Wunused-parameter', '-Wunreachable-code',
>>>>>>>>>>>> '-Wno-conversion', '-Wno-unused-local-typedef', '-c', '&&',
>>>>>>>>>>>> '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++',
>>>>>>>>>>>> '-o',
>>>>>>>>>>>> '/Users/buildslave/jenkins/sharedspace/libcxx/build/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/Output/last_write_time.pass.cpp.exe',
>>>>>>>>>>>> '/Users/buildslave/jenkins/sharedspace/libcxx/build/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/Output/last_write_time.pass.cpp.o',
>>>>>>>>>>>> '-v', '-arch', 'x86_64', '-mmacosx-version-min=10.13',
>>>>>>>>>>>> '-D_LIBCPP_DISABLE_AVAILABILITY', '-ftemplate-depth=270',
>>>>>>>>>>>> '-L/Users/buildslave/jenkins/sharedspace/libcxx/build/lib',
>>>>>>>>>>>> '-Wl,-rpath,/Users/buildslave/jenkins/sharedspace/libcxx/build/lib',
>>>>>>>>>>>> '-nodefaultlibs', '-lc++experimental', '-lc++', '-lSystem']
>>>>>>>>>>>> Command:
>>>>>>>>>>>> ['/Users/buildslave/jenkins/sharedspace/libcxx/build/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/Output/last_write_time.pass.cpp.exe']
>>>>>>>>>>>> Exit Code: 1
>>>>>>>>>>>> Standard Error:
>>>>>>>>>>>> --
>>>>>>>>>>>> In set_last_write_time_dynamic_env_test():451 Assertion
>>>>>>>>>>>> TEST_CHECK(CompareTime(got_time, TC.new_time)) failed.
>>>>>>>>>>>>     in file:
>>>>>>>>>>>> /Users/buildslave/jenkins/sharedspace/libcxx/libcxx.src/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>>>>>>
>>>>>>>>>>>> In set_last_write_time_dynamic_env_test():451 Assertion
>>>>>>>>>>>> TEST_CHECK(CompareTime(got_time, TC.new_time)) failed.
>>>>>>>>>>>>     in file:
>>>>>>>>>>>> /Users/buildslave/jenkins/sharedspace/libcxx/libcxx.src/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>>>>>>
>>>>>>>>>>>> In set_last_write_time_dynamic_env_test():451 Assertion
>>>>>>>>>>>> TEST_CHECK(CompareTime(got_time, TC.new_time)) failed.
>>>>>>>>>>>>     in file:
>>>>>>>>>>>> /Users/buildslave/jenkins/sharedspace/libcxx/libcxx.src/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>>>>>>
>>>>>>>>>>>> In set_last_write_time_dynamic_env_test():451 Assertion
>>>>>>>>>>>> TEST_CHECK(CompareTime(got_time, TC.new_time)) failed.
>>>>>>>>>>>>     in file:
>>>>>>>>>>>> /Users/buildslave/jenkins/sharedspace/libcxx/libcxx.src/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>>>>>>
>>>>>>>>>>>> In set_last_write_time_dynamic_env_test():451 Assertion
>>>>>>>>>>>> TEST_CHECK(CompareTime(got_time, TC.new_time)) failed.
>>>>>>>>>>>>     in file:
>>>>>>>>>>>> /Users/buildslave/jenkins/sharedspace/libcxx/libcxx.src/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>>>>>>
>>>>>>>>>>>> In set_last_write_time_dynamic_env_test():451 Assertion
>>>>>>>>>>>> TEST_CHECK(CompareTime(got_time, TC.new_time)) failed.
>>>>>>>>>>>>     in file:
>>>>>>>>>>>> /Users/buildslave/jenkins/sharedspace/libcxx/libcxx.src/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>>>>>>
>>>>>>>>>>>> In set_last_write_time_dynamic_env_test():451 Assertion
>>>>>>>>>>>> TEST_CHECK(CompareTime(got_time, TC.new_time)) failed.
>>>>>>>>>>>>     in file:
>>>>>>>>>>>> /Users/buildslave/jenkins/sharedspace/libcxx/libcxx.src/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>>>>>>
>>>>>>>>>>>> In set_last_write_time_dynamic_env_test():451 Assertion
>>>>>>>>>>>> TEST_CHECK(CompareTime(got_time, TC.new_time)) failed.
>>>>>>>>>>>>     in file:
>>>>>>>>>>>> /Users/buildslave/jenkins/sharedspace/libcxx/libcxx.src/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>>>>>>
>>>>>>>>>>>> In last_write_time_symlink_test():477 Assertion
>>>>>>>>>>>> TEST_CHECK(got_time == new_time) failed.
>>>>>>>>>>>>     in file:
>>>>>>>>>>>> /Users/buildslave/jenkins/sharedspace/libcxx/libcxx.src/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>>>>>>
>>>>>>>>>>>> In last_write_time_symlink_test():479 Assertion
>>>>>>>>>>>> TEST_CHECK(CompareTime(LastWriteTime(file), new_time)) failed.
>>>>>>>>>>>>     in file:
>>>>>>>>>>>> /Users/buildslave/jenkins/sharedspace/libcxx/libcxx.src/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
>>>>>>>>>>>>
>>>>>>>>>>>> Summary for testsuite last_write_time_test_suite:
>>>>>>>>>>>>     7 of 9 test cases passed.
>>>>>>>>>>>>     78 of 88 assertions passed.
>>>>>>>>>>>>     0 unsupported test cases.
>>>>>>>>>>>> --
>>>>>>>>>>>>
>>>>>>>>>>>> Compiled test failed unexpectedly!
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks,
>>>>>>>>>>>> Alex
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On 25 July 2018 at 17:00, Alex L <arphaman at gmail.com> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Sure! Fixed it up in r337984.
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 25 July 2018 at 15:03, Eric Fiselier <eric at efcs.ca> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Wed, Jul 25, 2018 at 3:39 PM Alex L <arphaman at gmail.com>
>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Looks like this works:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> +++ b/src/experimental/filesystem/filesystem_common.h
>>>>>>>>>>>>>>> @@ -393,7 +393,7 @@ bool set_file_times(const path& p,
>>>>>>>>>>>>>>> std::array<TimeSpec, 2> const& TS,
>>>>>>>>>>>>>>>                      error_code& ec) {
>>>>>>>>>>>>>>>  #if !defined(_LIBCPP_USE_UTIMENSAT)
>>>>>>>>>>>>>>>    using namespace chrono;
>>>>>>>>>>>>>>> -  auto Convert = [](long nsec) {
>>>>>>>>>>>>>>> +  auto Convert = [](long nsec) ->
>>>>>>>>>>>>>>> decltype(std::declval<::timeval>().tv_usec) {
>>>>>>>>>>>>>>>      return
>>>>>>>>>>>>>>> duration_cast<microseconds>(nanoseconds(nsec)).count();
>>>>>>>>>>>>>>>    };
>>>>>>>>>>>>>>>    struct ::timeval ConvertedTS[2] = {{TS[0].tv_sec,
>>>>>>>>>>>>>>> Convert(TS[0].tv_nsec)},
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I will commit this fix in a couple of minutes.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I think I would prefer an explicit cast to an implicit one
>>>>>>>>>>>>>> since the narrowing is intended, and should be safe.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Maybe:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> auto Convert [](long nsec) {
>>>>>>>>>>>>>>   using int_type = decltype(::timeval::tv_usec);
>>>>>>>>>>>>>>   auto dur =
>>>>>>>>>>>>>> duration_cast<microseconds>(nanoseconds(nsec)).count();
>>>>>>>>>>>>>>   return static_cast<int_type>(dur);
>>>>>>>>>>>>>> };
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180725/3b7fa081/attachment-0001.html>


More information about the cfe-commits mailing list