[libcxx-commits] [PATCH] D154282: [libc++][chrono] Adds tzdb_list implementation.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jul 2 12:34:38 PDT 2023


Mordante created this revision.
Herald added subscribers: arphaman, krytarowski, arichardson.
Herald added a project: All.
Mordante updated this revision to Diff 536582.
Mordante added a comment.
Mordante updated this revision to Diff 536585.
Mordante updated this revision to Diff 536596.
Mordante updated this revision to Diff 536607.
Herald added a subscriber: mstorsjo.
Mordante updated this revision to Diff 536609.
Mordante updated this revision to Diff 536610.
Mordante updated this revision to Diff 536617.
Mordante published this revision for review.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

CI fixes.


Mordante added a comment.

CI fixes.


Mordante added a comment.

Test CI.


Mordante added a comment.

CI fixes.


Mordante added a comment.

CI fixes.


Mordante added a comment.

Retrigger CI.


Mordante added a comment.

Reenable full CI.



================
Comment at: libcxx/CMakeLists.txt:307
 
+set(LIBCXX_TIME_ZONE_DB "" CACHE PATH
+  "Where the time zone data files are found. When the path is empty
----------------
This patch needs to be added to the release notes. However since this is the start of a rather large feature it makes sense to post-pone landing this after LLVM-17 has branched. To avoid merge conflicts the release notes aren't updated yet.


================
Comment at: libcxx/include/module.modulemap.in:786
+      module tzdb {
+        private header "__chrono/tzdb.h"
+        export string
----------------
Add  `@requires_LIBCXX_ENABLE_LOCALIZATION@` and filesystem here and next file.


================
Comment at: libcxx/src/CMakeLists.txt:321
 
+if (LIBCXX_ENABLE_LOCALIZATION AND LIBCXX_ENABLE_FILESYSTEM)
+  list(APPEND LIBCXX_EXPERIMENTAL_SOURCES
----------------
Review note.

This patch can avoid the dependency to the file system. However future patches will require the file system `std::chrono::current_zone()` on Unix-like systems needs to resolve the target of the symlink `/etc/localtime` which points to something like `/usr/share/zoneinfo/Europe/Berlin`. In this case `Europe/Berlin` is the name of the current time zone.

Localization could be avoided by using a C file I/O API. This might make sense when there are a lot of vendors with filesystem support, but without locale support.


This is the first step to implement time zone support in libc++. This
adds the complete tzdb_list class and a minimal tzdb class. The tzdb
class only contains the version, which is used by reload_tzdb.

Next to these classes it contains documentation and build system support
needed for time zone support. The code depends on the IANA Time Zone
Database, which should be available on the platform used or provided by
the libc++ vendors.

The code is labeled as experimental since there will be ABI breaks
during development; the tzdb class needs to have the standard headers.

Implements parts of:

- P0355 Extending <chrono> to Calendars and Time Zones

Addresses:

- LWG3319 Properly reference specification of IANA time zone database


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154282

Files:
  libcxx/CMakeLists.txt
  libcxx/docs/BuildingLibcxx.rst
  libcxx/docs/DesignDocs/TimeZone.rst
  libcxx/docs/Status/Cxx20.rst
  libcxx/docs/Status/Cxx20Issues.csv
  libcxx/docs/Status/Cxx20Papers.csv
  libcxx/docs/UsingLibcxx.rst
  libcxx/docs/index.rst
  libcxx/include/CMakeLists.txt
  libcxx/include/__availability
  libcxx/include/__chrono/tzdb.h
  libcxx/include/__chrono/tzdb_list.h
  libcxx/include/__config
  libcxx/include/chrono
  libcxx/include/module.modulemap.in
  libcxx/modules/std/chrono.cppm
  libcxx/src/CMakeLists.txt
  libcxx/src/tz.cpp
  libcxx/test/libcxx/experimental/fexperimental-library.compile.pass.cpp
  libcxx/test/libcxx/time/time.zone/time.zone.db/time.zone.db.list/erase_after.pass.cpp
  libcxx/test/libcxx/time/time.zone/time.zone.db/time.zone.db.remote/reload_tzdb.pass.cpp
  libcxx/test/libcxx/time/time.zone/time.zone.db/version.pass.cpp
  libcxx/test/libcxx/transitive_includes.gen.py
  libcxx/test/libcxx/transitive_includes/cxx03.csv
  libcxx/test/libcxx/transitive_includes/cxx11.csv
  libcxx/test/libcxx/transitive_includes/cxx14.csv
  libcxx/test/libcxx/transitive_includes/cxx17.csv
  libcxx/test/libcxx/transitive_includes/cxx20.csv
  libcxx/test/libcxx/transitive_includes/cxx23.csv
  libcxx/test/libcxx/transitive_includes/cxx26.csv
  libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.access/get_tzdb.pass.cpp
  libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.access/get_tzdb_list.pass.cpp
  libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.list/erase_after.compile.pass.cpp
  libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.list/front.pass.cpp
  libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.list/iterators.pass.cpp
  libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.list/types.compile.pass.cpp
  libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.remote/reload_tzdb.pass.cpp
  libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.remote/remote_version.pass.cpp
  libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.tzdb/tzdb.members.pass.cpp
  libcxx/utils/libcxx/test/features.py
  libcxx/utils/libcxx/test/params.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154282.536617.patch
Type: text/x-patch
Size: 60087 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230702/700ad03f/attachment-0001.bin>


More information about the libcxx-commits mailing list