Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:14

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP___CHRONO_FILE_CLOCK_H
0011 #define _LIBCPP___CHRONO_FILE_CLOCK_H
0012 
0013 #include <__chrono/duration.h>
0014 #include <__chrono/system_clock.h>
0015 #include <__chrono/time_point.h>
0016 #include <__config>
0017 #include <ratio>
0018 
0019 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0020 #  pragma GCC system_header
0021 #endif
0022 
0023 #ifndef _LIBCPP_CXX03_LANG
0024 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
0025 struct _FilesystemClock;
0026 _LIBCPP_END_NAMESPACE_FILESYSTEM
0027 #endif // !_LIBCPP_CXX03_LANG
0028 
0029 #if _LIBCPP_STD_VER >= 20
0030 
0031 _LIBCPP_BEGIN_NAMESPACE_STD
0032 
0033 namespace chrono {
0034 
0035 // [time.clock.file], type file_clock
0036 using file_clock = filesystem::_FilesystemClock;
0037 
0038 template <class _Duration>
0039 using file_time = time_point<file_clock, _Duration>;
0040 
0041 } // namespace chrono
0042 
0043 _LIBCPP_END_NAMESPACE_STD
0044 
0045 #endif // _LIBCPP_STD_VER >= 20
0046 
0047 #ifndef _LIBCPP_CXX03_LANG
0048 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
0049 struct _FilesystemClock {
0050 #  if _LIBCPP_HAS_INT128
0051   typedef __int128_t rep;
0052   typedef nano period;
0053 #  else
0054   typedef long long rep;
0055   typedef nano period;
0056 #  endif
0057 
0058   typedef chrono::duration<rep, period> duration;
0059   typedef chrono::time_point<_FilesystemClock> time_point;
0060 
0061   _LIBCPP_EXPORTED_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = false;
0062 
0063   _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_EXPORTED_FROM_ABI static time_point now() noexcept;
0064 
0065 #  if _LIBCPP_STD_VER >= 20
0066   template <class _Duration>
0067   _LIBCPP_HIDE_FROM_ABI static chrono::sys_time<_Duration> to_sys(const chrono::file_time<_Duration>& __t) {
0068     return chrono::sys_time<_Duration>(__t.time_since_epoch());
0069   }
0070 
0071   template <class _Duration>
0072   _LIBCPP_HIDE_FROM_ABI static chrono::file_time<_Duration> from_sys(const chrono::sys_time<_Duration>& __t) {
0073     return chrono::file_time<_Duration>(__t.time_since_epoch());
0074   }
0075 #  endif // _LIBCPP_STD_VER >= 20
0076 };
0077 _LIBCPP_END_NAMESPACE_FILESYSTEM
0078 #endif // !_LIBCPP_CXX03_LANG
0079 
0080 #endif // _LIBCPP___CHRONO_FILE_CLOCK_H