[PATCH] D49774: [libc++] Use __int128_t to represent file_time_type.

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 24 20:00:35 PDT 2018


EricWF created this revision.
EricWF added reviewers: mclow.lists, ldionne, joerg, arthur.j.odwyer.
Herald added subscribers: cfe-commits, christof.

The ``file_time_type`` time point is used to represent the write times for files.
Its job is to act as part of a C++ wrapper for less ideal system interfaces. The
underlying filesystem uses the ``timespec`` struct for the same purpose.

However, the initial implementation of ``file_time_type`` could not represent
either the range or resolution of ``timespec``, making it unsuitable. Fixing
this requires an implementation which uses more than 64 bits to store the
time point.

I primarily considered two solutions: Using ``__int128_t`` and using a
arithmetic emulation of ``timespec``. Each has its pros and cons, and both
come with more than one complication.

However, after a lot of consideration, I decided on using `__int128_t`. This patch implements that change.

Please see the FileTimeType Design Document <http://libcxx.llvm.org/docs/DesignDocs/FileTimeType.html> for more information.


Repository:
  rCXX libc++

https://reviews.llvm.org/D49774

Files:
  include/experimental/filesystem
  src/chrono.cpp
  src/experimental/filesystem/filesystem_common.h
  src/experimental/filesystem/operations.cpp
  src/include/apple_availability.h
  test/libcxx/experimental/filesystem/class.directory_entry/directory_entry.mods/last_write_time.sh.cpp
  test/libcxx/experimental/filesystem/convert_file_time.sh.cpp
  test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp
  test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49774.157188.patch
Type: text/x-patch
Size: 63219 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180725/4c3acb0d/attachment-0001.bin>


More information about the cfe-commits mailing list