[libcxx-commits] [libcxx] 341cc1b - [libcxx] Remove nonstandard _FilesystemClock::{to, from}_time_t

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 4 01:25:42 PDT 2021


Author: Martin Storsjö
Date: 2021-11-04T10:24:47+02:00
New Revision: 341cc1b4113223352c99199f7c26ea7329d00fb7

URL: https://github.com/llvm/llvm-project/commit/341cc1b4113223352c99199f7c26ea7329d00fb7
DIFF: https://github.com/llvm/llvm-project/commit/341cc1b4113223352c99199f7c26ea7329d00fb7.diff

LOG: [libcxx] Remove nonstandard _FilesystemClock::{to,from}_time_t

These are not standard methods, neither libstdc++ nor MSVC STL provide
them.

In practice, one of them was untested and the other one was only used in
one single test.

Differential Revision: https://reviews.llvm.org/D113027

Added: 
    

Modified: 
    libcxx/docs/ReleaseNotes.rst
    libcxx/include/chrono
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst
index d2713a9bfe4bf..5f81b3ea8496c 100644
--- a/libcxx/docs/ReleaseNotes.rst
+++ b/libcxx/docs/ReleaseNotes.rst
@@ -78,6 +78,10 @@ API Changes
   exceeds the maximum supported size, as required by the C++ standard.
   Previously the type ``std::length_error`` was used.
 
+- Removed the nonstandard methods ``std::chrono::file_clock::to_time_t`` and
+  ``std::chrono::file_clock::from_time_t``; neither libstdc++ nor MSVC STL
+  had such methods.
+
 ABI Changes
 -----------
 

diff  --git a/libcxx/include/chrono b/libcxx/include/chrono
index d05b3dbe37557..ec510a99b5831 100644
--- a/libcxx/include/chrono
+++ b/libcxx/include/chrono
@@ -2798,19 +2798,6 @@ struct _FilesystemClock {
   static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false;
 
   _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS static time_point now() noexcept;
-
-  _LIBCPP_INLINE_VISIBILITY
-  static time_t to_time_t(const time_point& __t) noexcept {
-      typedef chrono::duration<rep> __secs;
-      return time_t(
-          chrono::duration_cast<__secs>(__t.time_since_epoch()).count());
-  }
-
-  _LIBCPP_INLINE_VISIBILITY
-  static time_point from_time_t(time_t __t) noexcept {
-      typedef chrono::duration<rep> __secs;
-      return time_point(__secs(__t));
-  }
 };
 _LIBCPP_END_NAMESPACE_FILESYSTEM
 #endif // !_LIBCPP_CXX03_LANG

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
index c7dc60681ceee..a6247293a075b 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
@@ -433,7 +433,6 @@ TEST_CASE(read_last_write_time_static_env_test)
 
 TEST_CASE(get_last_write_time_dynamic_env_test)
 {
-    using Clock = file_time_type::clock;
     using Sec = std::chrono::seconds;
     scoped_test_env env;
 
@@ -446,11 +445,9 @@ TEST_CASE(get_last_write_time_dynamic_env_test)
     const TimeSpec dir_write_time = dir_times.write;
 
     file_time_type ftime = last_write_time(file);
-    TEST_CHECK(Clock::to_time_t(ftime) == file_write_time.tv_sec);
     TEST_CHECK(CompareTime(ftime, file_write_time));
 
     file_time_type dtime = last_write_time(dir);
-    TEST_CHECK(Clock::to_time_t(dtime) == dir_write_time.tv_sec);
     TEST_CHECK(CompareTime(dtime, dir_write_time));
 
     SleepFor(Sec(2));


        


More information about the libcxx-commits mailing list