forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libc++][chrono] Adds the sys_info class. (llvm#85619)
Adds the sys_info class and time_zone::get_info(). The code still has a few quirks and has not been optimized for performance yet. The returned sys_info is compared against the output of the zdump tool in the test giving confidence the implementation is correct. Implements parts of: - P0355 Extending <chrono> to Calendars and Time Zones Implements: - LWGXXXX The sys_info range should be affected by save
- Loading branch information
Showing
22 changed files
with
2,916 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// -*- C++ -*- | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html | ||
|
||
#ifndef _LIBCPP___CHRONO_SYS_INFO_H | ||
#define _LIBCPP___CHRONO_SYS_INFO_H | ||
|
||
#include <version> | ||
// Enable the contents of the header only when libc++ was built with experimental features enabled. | ||
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB) | ||
|
||
# include <__chrono/duration.h> | ||
# include <__chrono/system_clock.h> | ||
# include <__chrono/time_point.h> | ||
# include <__config> | ||
# include <string> | ||
|
||
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
# pragma GCC system_header | ||
# endif | ||
|
||
_LIBCPP_BEGIN_NAMESPACE_STD | ||
|
||
# if _LIBCPP_STD_VER >= 20 | ||
|
||
namespace chrono { | ||
|
||
struct sys_info { | ||
sys_seconds begin; | ||
sys_seconds end; | ||
seconds offset; | ||
minutes save; | ||
string abbrev; | ||
}; | ||
|
||
} // namespace chrono | ||
|
||
# endif //_LIBCPP_STD_VER >= 20 | ||
|
||
_LIBCPP_END_NAMESPACE_STD | ||
|
||
#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB) | ||
|
||
#endif // _LIBCPP___CHRONO_SYS_INFO_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.