summaryrefslogtreecommitdiffstats
path: root/libcxx/src/chrono.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Chrono][Darwin] Include header for gettimeofdayBruno Cardoso Lopes2017-01-101-1/+1
| | | | | | | Followup on r291466 and include the proper header. This fixes: https://build.chromium.org/p/chromium.fyi/builders/ClangToTMac/builds/12620/steps/gclient%20runhooks/logs/stdio llvm-svn: 291517
* [Chrono][Darwin] Make steady_clock use CLOCK_UPTIME_RAWBruno Cardoso Lopes2017-01-091-3/+45
| | | | | | | | | | | | | | Use CLOCK_UPTIME_RAW in case clock_gettime is available on Darwin. On Apple platforms only CLOCK_UPTIME_RAW or mach_absolute_time are able to time functions in the nanosecond range. Thus, they are the only acceptable implementations of steady_clock. Differential Revision: https://reviews.llvm.org/D27429 rdar://problem/29449467 llvm-svn: 291466
* clean up use of _WIN32Saleem Abdulrasool2017-01-031-6/+6
| | | | | | | | | Replace the use of _WIN32 in libc++. Replace most use with a C runtime check _LIBCPP_MSVCRT or the new _LIBCPP_WIN32 to indicate that we are using the Win32 API. Use a new _LIBCPP_WCHAR_IS_UCS2 to indicate that we are on an environment that has a short wchar_t. llvm-svn: 290910
* chrono: correct the units for the epoch biasSaleem Abdulrasool2017-01-021-2/+1
| | | | | | | | As pointed out by Howard, this is actually 134774 days (* 24 * 3600), and therefore seconds, not 100ns units. Adjust the units to reflect reality. llvm-svn: 290824
* chrono: address post commit comments from HowardSaleem Abdulrasool2017-01-011-13/+17
| | | | | | | | | | | | | | | | | Drawing some inspiration from code from Bill O'Neal as pointed out by Howard, rework the code to avoid an overflow in the duration. Adjust the style to match libc++ style as well. Create a local typedef for the FILETIME duration (100-ns units). Use this to define the difference between the NT and the UNIX epochs (which previously overflowed due to the representation limits due to the bouncing to ns). Return the FILETIME duration biased by the NT-to-UNIX epoch conversion. Use of the custom duration makes it easier to read and reason about the code. llvm-svn: 290806
* chrono: address post-commit comments from majnemerSaleem Abdulrasool2017-01-011-8/+8
| | | | | | | Correct style to match libc++ style as pointed out by David Majnemer on IRC. NFC. llvm-svn: 290805
* chrono: give Windows a steady_clockSaleem Abdulrasool2017-01-011-14/+29
| | | | | | | Provide a definition for a steady monotonic clock by wrapping QueryPerformanceCounter. llvm-svn: 290804
* chrono: implement a Windows version of system_clock::nowSaleem Abdulrasool2017-01-011-0/+32
| | | | | | | | | | | | | | system_clock::now is not entirely straight forward on Windows, which does not have a clock_gettime function. GetSystemTimeAsFileTime gives us the value relative to the NT epoch (Jan 1 1601) rather than the Unix epoch (Jan 1 1970). However, this function has a low resolution (~10ms). Newer versions of Windows provide GetSystemTimePreciseAsFileTime which gives us a much more accurate time (<1us). Unfortunately, the latter is only available on Windows 8+ when targeting desktop apps. llvm-svn: 290803
* [libc++] Remove unneeded visibility pragmasShoaib Meenai2016-11-231-4/+0
| | | | | | | | | | The function definitions being guarded by the pragma were all static, so they wouldn't be exported anyway. In any case, we should prefer the visibility macros. No functional change. Differential Revision: https://reviews.llvm.org/D26940 llvm-svn: 287768
* Remove workarounds for C++17 inline variable ABI break. It has been fixed in ↵Eric Fiselier2016-07-021-7/+0
| | | | | | clang. llvm-svn: 274419
* Remove accidental change committed in r274403.Eric Fiselier2016-07-011-1/+1
| | | | llvm-svn: 274407
* Work around ABI break caused by C++17 inline variables.Eric Fiselier2016-07-011-1/+8
| | | | llvm-svn: 274403
* When building libc++, we use '"' as a delimiter instead of '<' when ↵Marshall Clow2015-06-231-3/+3
| | | | | | including libc++ header files. This is so that the dylib gets built with our headers; rather than the system-installed ones. We do this in most places already, just fixing a couple of inconsistent uses. llvm-svn: 240412
* Use clock_gettime()'s CLOCK_REALTIME instead of gettimeofday().Ed Schouten2015-05-141-24/+40
| | | | | | | | | | | | | | | | | | | | | The system_clock::now() function currently uses gettimeofday(). The problem with gettimeofday() is that it is an obsolete XSI function, hence unavailable on CloudABI. See: http://pubs.opengroup.org/onlinepubs/9699919799/functions/gettimeofday.html Change this code to use clock_gettime() with CLOCK_REALTIME instead, which is more consistent, as clock_gettime() is already used for steady_clock. A previous version of this change actually attempted to change system_clock::duration, but I reverted this part as it breaks the existing ABI. Differential Revision: http://reviews.llvm.org/D8253 Approved by: jroelofs llvm-svn: 237390
* Fix comment that was obsoleted by r216949Jonathan Roelofs2014-09-021-4/+2
| | | | llvm-svn: 216999
* Partially address a FIXME in steady_clock::now()Jonathan Roelofs2014-09-021-0/+3
| | | | | | http://reviews.llvm.org/D4045 llvm-svn: 216949
* Removed raw references to __APPLE__; now just check to see if it is defined.Marshall Clow2013-03-181-2/+2
| | | | llvm-svn: 177297
* Zhang Xiongpang: Add definitions for const data members. Fixes ↵Howard Hinnant2012-12-121-0/+4
| | | | | | http://llvm.org/bugs/show_bug.cgi?id=14585. llvm-svn: 170026
* Quash a whole bunch of warningsHoward Hinnant2011-12-011-1/+1
| | | | llvm-svn: 145624
* noexcept for <chrono>.Howard Hinnant2011-05-281-5/+5
| | | | llvm-svn: 132265
* N3191: C++ Timeout SpecificationHoward Hinnant2010-11-201-18/+18
| | | | llvm-svn: 119909
* license changeHoward Hinnant2010-11-161-2/+2
| | | | llvm-svn: 119395
* Fix typos, noticed by Clang.Daniel Dunbar2010-09-041-1/+1
| | | | llvm-svn: 113061
* Fixing whitespace problemsHoward Hinnant2010-08-221-3/+3
| | | | llvm-svn: 111751
* patch by Jeffrey Yasskin for porting to Ubuntu Hardy. Everything was ↵Howard Hinnant2010-05-241-0/+27
| | | | | | accepted except there were some bug fixes needed in <locale> for the __nolocale_* series. For the apple branch I ended up using templates instead of the var_args solution because it seemed both safer and more efficient. llvm-svn: 104516
* Wiped out some non-ascii characters that snuck into the copyright.Howard Hinnant2010-05-111-1/+1
| | | | llvm-svn: 103516
* libcxx initial importHoward Hinnant2010-05-111-0/+101
llvm-svn: 103490
OpenPOWER on IntegriCloud