Skip to content

Commit

Permalink
<chrono>: Partially implement P0355R7 (#323)
Browse files Browse the repository at this point in the history
Co-authored-by: Curtis Jacques Bezault <[email protected]>
Co-authored-by: MattStephanson <[email protected]>
Co-authored-by: mnatsuhara <[email protected]>
Co-authored-by: Stephan T. Lavavej <[email protected]>
  • Loading branch information
5 people authored Feb 1, 2021
1 parent c319a7b commit 6779b61
Show file tree
Hide file tree
Showing 16 changed files with 3,048 additions and 407 deletions.
1,464 changes: 1,417 additions & 47 deletions stl/inc/chrono

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@
// P0318R1 unwrap_reference, unwrap_ref_decay
// P0325R4 to_array()
// P0339R6 polymorphic_allocator<>
// P0355R7 <chrono> Calendars And Time Zones
// (partially implemented)
// P0356R5 bind_front()
// P0357R3 Supporting Incomplete Types In reference_wrapper
// P0408R7 Efficient Access To basic_stringbuf's Buffer
Expand Down Expand Up @@ -1293,6 +1295,7 @@ compiler option, or define _ALLOW_RTCc_IN_STL to acknowledge that you have recei
#define _STD_BEGIN namespace std {
#define _STD_END }
#define _STD ::std::
#define _CHRONO ::std::chrono::
#define _RANGES ::std::ranges::

// We use the stdext (standard extension) namespace to contain extensions that are not part of the current standard
Expand Down
204 changes: 24 additions & 180 deletions tests/libcxx/expected_results.txt

Large diffs are not rendered by default.

204 changes: 24 additions & 180 deletions tests/libcxx/skipped_tests.txt

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions tests/std/test.lst
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,12 @@ tests\P0220R1_searchers
tests\P0220R1_string_view
tests\P0325R4_to_array
tests\P0339R6_polymorphic_allocator
tests\P0355R7_calendars_and_time_zones_clocks
tests\P0355R7_calendars_and_time_zones_dates
tests\P0355R7_calendars_and_time_zones_dates_literals
tests\P0355R7_calendars_and_time_zones_hms
tests\P0355R7_calendars_and_time_zones_io
tests\P0355R7_calendars_and_time_zones_time_point_and_durations
tests\P0356R5_bind_front
tests\P0357R3_supporting_incomplete_types_in_reference_wrapper
tests\P0408R7_efficient_access_to_stringbuf_buffer
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

RUNALL_INCLUDE ..\usual_latest_matrix.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <chrono>

using namespace std::chrono;

struct not_a_clock {
bool rep();
static char period;
int duration();
static float time_point;
using is_steady = long;
static int now;
};

struct real_fake_clock {
using rep = bool;
using period = char;
using duration = float;
using time_point = int;
static long is_steady;
static short now();
};

struct no_rep {
using period = char;
using duration = float;
using time_point = int;
static long is_steady;
static short now();
};

struct no_period {
using rep = bool;
using duration = float;
using time_point = int;
static long is_steady;
static short now();
};

struct no_duration {
using rep = bool;
using period = char;
using time_point = int;
static long is_steady;
static short now();
};

struct no_time_point {
using rep = bool;
using period = char;
using duration = float;
static long is_steady;
static short now();
};

struct no_steady {
using rep = bool;
using period = char;
using duration = float;
using time_point = int;
static short now();
};

struct no_now {
using rep = bool;
using period = char;
using duration = float;
using time_point = int;
static long is_steady;
};

static_assert(is_clock<steady_clock>::value, "steady_clock is not a clock");
static_assert(is_clock_v<steady_clock>, "steady_clock is not a clock");
static_assert(is_clock_v<real_fake_clock>, "real_fake_clock is not a clock");
static_assert(!is_clock_v<not_a_clock>, "not_a_clock is a clock");

static_assert(!is_clock_v<no_rep>, "no_rep is a clock");
static_assert(!is_clock_v<no_period>, "no_period is a clock");
static_assert(!is_clock_v<no_duration>, "no_duration is a clock");
static_assert(!is_clock_v<no_time_point>, "no_time_point is a clock");
static_assert(!is_clock_v<no_steady>, "no_steady is a clock");
static_assert(!is_clock_v<no_now>, "no_now is a clock");

int main() {} // COMPILE-ONLY
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

RUNALL_INCLUDE ..\usual_latest_matrix.lst
Loading

0 comments on commit 6779b61

Please sign in to comment.