33 Commits

Author SHA1 Message Date
Martin Zink
8a93211679 #826 Build fix for ambiguity with >= libc++ 17 2024-05-10 16:26:43 -04:00
Aaron Franke
417402ad35
Remove trailing whitespace and add gitattributes (#672) 2021-05-24 08:22:43 -04:00
Howard Hinnant
1ec2ea0295 Add test/tz_test/tzdb_list.pass.cpp 2020-08-17 21:34:20 -04:00
Tomasz Kamiński
5a0057587d Correct behavior for classes for which only lvalue is convertible to string_view.
Added OnlyLValueString test case that shows the problem with
current impl. Implemented the change, that accept TimeZonePtrOrName
by forwarding reference (to preserve value category), and
merged time_zone selection into one trait.
2019-09-01 14:43:50 -04:00
Tomasz Kamiński
5345d135b7 Implemented custom time zone deduction test.
Implemented test for deduction from the custom time zone ptr.
Used OffsetZone extracted for that purpose.
2019-09-01 14:43:50 -04:00
Tomasz Kamiński
1d721d9afd Implemented set of basic deduction test.
Implemented test for deduction from string, string_view,
time_zone ptr and other zoned_time.
2019-09-01 14:43:50 -04:00
tomaszkam
e86edc3820 Added missing license to unit test files (#356) 2018-06-23 10:39:00 -04:00
Tomasz Kamiński
df31560701 Moved test to clock_cast_test dir 2018-06-11 10:45:41 -04:00
Tomasz Kamiński
4b687f4c04 Test is now C++11 compatible 2018-06-11 10:45:41 -04:00
Tomasz Kamiński
db60c5eb8e Unit test and typo fix 2018-06-11 10:45:41 -04:00
Harry Mallon
c311db2f1a Clean up tz_test README 2018-03-18 18:14:40 -04:00
Tomasz Kamiński
9910f5fcc3 Moved clock_cast test to separate dir.
Fixed naqme of the to_sys_return_reference test, so it
is invoked.
2017-11-24 22:30:54 +01:00
Tomasz Kamiński
58a4a9518a Mismatch in return type of converting function is now hard error.
Change the implementation, in the way that mismatch in return
type of the from/to_sys/utc functions (not returning time_point,
or returning time_point with inappropriate clock) leads to
hard error.

Added appropariate fail test for to_sys function, including:
* returning an int
* returning time_point of wrong clock
* reutrning reference to time_point
2017-11-24 22:23:50 +01:00
Tomasz Kamiński
5a9b44a37a Implemented test for casting non-wall clocks and detecting that clocks cannot be casted.
Added test that detects if clock_cast<Dest>(Source) properly
SFINAEs if clock's are not castable, this includes test for
steady_clock that is not castable to any wall-clock.

Secondly added steady_based_clock based on steady_clock
(as name indicates), that clock_cast may be extended to clock
non-related to wall-time (sys/utc) using conversion traits.

Final example is pair of ambiguous clocks (amb1/amb2_clock) that can convert
to each other either using sys_clock or utc_clock.
Then the conversion from amb2 to amb1 is disambiguated
via trait specialization.
2017-11-24 18:08:00 +01:00
Tomasz Kamiński
a9d2907fa1 Implemented test for custom clocks derived from sys_clock.
Created mil_clock and s2s_clock, that are both using to_sys/from_sys
function and are fully interoperable with existing clocks (including
ones based on utc).

Implemented an trait is used to provide direct conversion
from s2s_clock to mil_clock without converting to sys_clock
(conversion counter is used for this purpose).
2017-11-24 18:07:33 +01:00
Tomasz Kamiński
bf5a4f3cd5 Implemented test for existing clocks.
Implemented test for conversions between existing clocks
(sys_clock, utc_clock, tai_clock, gps_clock) showing that
they can be used instead of to_clock_time functions.
2017-11-24 18:06:55 +01:00
Howard Hinnant
5563d31b2e Update validation.cpp for new directory structure 2017-10-24 12:06:50 -04:00
Howard Hinnant
aad6010831 Add test for custom time zone support 2017-08-31 10:44:07 -04:00
Howard Hinnant
893cf51fd8 Add test for zoned_time 2017-07-06 20:49:28 -04:00
Howard Hinnant
a610f087c1 Add support for the zic-compiled OS-supplied time zone DB:
*  Avoids the need to download the IANA database.

*  Heavily based on contributions by Aaron Bishop.

*  Turn on with -DUSE_OS_TZDB, off by default.

*  Not supported on Windows.

*  Disables HAS_REMOTE_API.

*  get_tzdb().version only supported on Apple.  This string has
   the value "unknown" elsewhere.

*  Leap second support is missing on Apple, and may not be on your
   platform either (please report).  Leap second support is enabled,
   disabled with -DMISSING_LEAP_SECONDS.

   Without leap second support, utc_time, tai_time, and gps_time (and
   those clocks) are not available.

*  On Apple, time zone transitions are only supported in the range:

   1901-12-13 20:45:52 to 2038-01-19 03:14:07

*  On Linux, time zone transitions are only as far in the future as
   the OS-provided transitions go.  There is no support for POSIX-
   style transitions.
2017-06-04 21:04:53 -04:00
Howard Hinnant
b4ca58d9a8 Revert "Remove support for using system() now other means proven."
This reverts commit ebf3b0776ab8d68ca9b3f4f02415092bc8935d75.
2016-08-05 20:16:09 -04:00
gm
ebf3b0776a Remove support for using system() now other means proven.
* Other miscellaneous improvements.
2016-07-27 18:45:10 -04:00
Howard Hinnant
b7e997adba Update 2016f validation file 2016-07-05 12:05:49 -04:00
Howard Hinnant
fc9d0bb99a Add 2016e validation file 2016-06-16 22:07:05 -04:00
gm
55087c6cbd HAS_REMOTE_API support for Windows. Adds support for MingW too.
* HAS_REMOTE_API still defaults to 0
* When HAS_REMOTE_API=0 only libraries advapi32.lib, ole32.lib and shell32.lib are required.
* Setting HAS_REMOTE_API=1 requires curl: https://curl.haxx.se/libcurl/
*- Also need to manually install 7-Zip (http://www.7-zip.org).
*- Will automatically install Tinyxml2 (http://www.grinninglizard.com/tinyxml2/).
*- Will automatically install http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml
2016-06-16 22:03:12 -04:00
gm
7e66cb2e83 Improve cross platform support.
Make validate work for C++11 because the library supports it.
Fix an unused variable mistake i made earlier.
Make constructor public, seems it should be. Possible compiler bug?
2016-06-04 13:38:50 -04:00
gm
c7960fbd89 Catch and display exception messages a Microsofts C runtime on Windows doesn't show them otherwise. 2016-06-02 00:52:32 +12:00
Howard Hinnant
630d67ce0d Rename Info to sys_info in test 2016-05-31 10:10:33 -04:00
Howard Hinnant
f5f0f80778 Get rid of tz. Hide unnecessary API. Clean up get_info 2016-05-08 22:59:39 -04:00
Howard Hinnant
1e5d2fa8dd Create local and system time types for timezone functions.
* Add sys_time.
* Add sys_days.
* Add sys_seconds.
* Add local_time.
* Add local_days.
* Add local_seconds.
* Rename day_point to sys_days.
* Rename Zone to time_zone.
2016-05-03 23:19:09 -04:00
Howard Hinnant
d8426940d7 Update tz validation test with more checking 2016-04-17 21:51:30 -04:00
Howard Hinnant
db9f0d19ba Make Zone move-only 2015-11-03 20:01:12 -05:00
Howard Hinnant
479cd16986 Add validate test for timezones 2015-08-15 16:00:42 -04:00