Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging [time.zone], [time.clock], and [time.parse] pieces of P0355R7 #1789

Merged
merged 24 commits into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5f4c4ba
Merge pull request #1716 from microsoft/main
StephanTLavavej Mar 4, 2021
6c87eac
<chrono>: C++20 clocks, clock_cast, tzdb::leap_seconds (#1671)
MattStephanson Mar 9, 2021
bf56ad9
Loading `time_zone` and `time_zone_link` names (#1723)
d-winsor Mar 12, 2021
2bc79d2
Logic for time_zone sys to local conversion (#1732)
d-winsor Mar 16, 2021
cb2b985
Support for zoned_time (#1752)
d-winsor Mar 19, 2021
74abbc2
Misc items for tzdb (#1765)
d-winsor Mar 23, 2021
027fc9f
<chrono> [time.parse] (#1768)
MattStephanson Mar 26, 2021
3017b91
chrono cleanups (#1779)
StephanTLavavej Mar 26, 2021
dde4623
`<chrono>`: Avoid unnecessary use of concepts (#1787)
StephanTLavavej Mar 29, 2021
6bcb4eb
stl/msbuild: Link advapi32.lib.
StephanTLavavej Mar 31, 2021
0c34af6
static_cast from int to bool to avoid warning C4800.
StephanTLavavej Mar 31, 2021
37c43ed
Add run_tz_test() to report exceptions and handle old OSes.
StephanTLavavej Mar 31, 2021
b0f132d
Remove _Invalid_time_string to fix the objsize test.
StephanTLavavej Mar 31, 2021
fd6ecdb
Work around VSO-1303556, an is_constructible_v ICE.
StephanTLavavej Mar 31, 2021
aa54dc4
Fix memory leaks.
StephanTLavavej Mar 31, 2021
620d71a
Code review feedback.
StephanTLavavej Mar 31, 2021
213fced
extract time_since_epoch()
mnatsuhara Apr 1, 2021
e885fd0
early returns
mnatsuhara Apr 1, 2021
cbadcdf
small restructuring
mnatsuhara Apr 1, 2021
a6b6a2c
pull _For_time into an enum template parameter
mnatsuhara Apr 1, 2021
10b9a70
Merge branch 'bye_feature_chrono' of https://github.com/mnatsuhara/ST…
mnatsuhara Apr 1, 2021
e83116e
Refactor another early-ish return.
StephanTLavavej Apr 2, 2021
c5a46da
Reorder _Parse_tp_or_duration, deducing _DurationType.
StephanTLavavej Apr 2, 2021
20fea0a
Test a later leap second.
StephanTLavavej Apr 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions azure-devops/create-vmss.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ $Prefix = 'StlBuild-' + (Get-Date -Format 'yyyy-MM-dd')
$VMSize = 'Standard_D32ds_v4'
$ProtoVMName = 'PROTOTYPE'
$LiveVMPrefix = 'BUILD'
$WindowsServerSku = '2019-Datacenter'
$ImagePublisher = 'MicrosoftWindowsDesktop'
$ImageOffer = 'Windows-10'
$ImageSku = '20h2-ent-g2'

$ProgressActivity = 'Creating Scale Set'
$TotalProgress = 12
Expand Down Expand Up @@ -268,9 +270,9 @@ $VM = Set-AzVMOperatingSystem `
$VM = Add-AzVMNetworkInterface -VM $VM -Id $Nic.Id
$VM = Set-AzVMSourceImage `
-VM $VM `
-PublisherName 'MicrosoftWindowsServer' `
-Offer 'WindowsServer' `
-Skus $WindowsServerSku `
-PublisherName $ImagePublisher `
-Offer $ImageOffer `
-Skus $ImageSku `
-Version latest

$VM = Set-AzVMBootDiagnostic -VM $VM -Disable
Expand Down Expand Up @@ -340,7 +342,7 @@ Set-AzVM `

$VM = Get-AzVM -ResourceGroupName $ResourceGroupName -Name $ProtoVMName
$PrototypeOSDiskName = $VM.StorageProfile.OsDisk.Name
$ImageConfig = New-AzImageConfig -Location $Location -SourceVirtualMachineId $VM.ID
$ImageConfig = New-AzImageConfig -Location $Location -SourceVirtualMachineId $VM.ID -HyperVGeneration 'V2'
$Image = New-AzImage -Image $ImageConfig -ImageName $ProtoVMName -ResourceGroupName $ResourceGroupName

####################################################################################################
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ variables:
buildOutputLocation: 'D:\build'
vcpkgLocation: '$(Build.SourcesDirectory)/vcpkg'

pool: 'StlBuild-2021-03-02'
pool: 'StlBuild-2021-03-09-win10'

stages:
- stage: Code_Format
Expand Down
4 changes: 3 additions & 1 deletion stl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
set(HEADERS
${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_all_public_headers.hpp
${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_system_error_abi.hpp
${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_tzdb.hpp
${CMAKE_CURRENT_LIST_DIR}/inc/algorithm
${CMAKE_CURRENT_LIST_DIR}/inc/any
${CMAKE_CURRENT_LIST_DIR}/inc/array
Expand Down Expand Up @@ -399,6 +400,7 @@ set(SOURCES_SATELLITE_ATOMIC_WAIT
${CMAKE_CURRENT_LIST_DIR}/src/atomic_wait.cpp
${CMAKE_CURRENT_LIST_DIR}/src/parallel_algorithms.cpp
${CMAKE_CURRENT_LIST_DIR}/src/syncstream.cpp
${CMAKE_CURRENT_LIST_DIR}/src/tzdb.cpp
)

set(SOURCES_SATELLITE_CODECVT_IDS
Expand Down Expand Up @@ -498,7 +500,7 @@ function(add_stl_dlls D_SUFFIX THIS_CONFIG_DEFINITIONS THIS_CONFIG_COMPILE_OPTIO
file(WRITE "${_ATOMIC_WAIT_DEF_NAME}" "${_ATOMIC_WAIT_DEF_CONTENTS}")

add_library(msvcp${D_SUFFIX}_atomic_wait SHARED "${_ATOMIC_WAIT_DEF_NAME}")
target_link_libraries(msvcp${D_SUFFIX}_atomic_wait PRIVATE msvcp${D_SUFFIX}_atomic_wait_objects msvcp${D_SUFFIX}_satellite_objects msvcp${D_SUFFIX}_implib_objects "msvcp${D_SUFFIX}" "${TOOLSET_LIB}/vcruntime${D_SUFFIX}.lib" "${TOOLSET_LIB}/msvcrt${D_SUFFIX}.lib" "ucrt${D_SUFFIX}.lib")
target_link_libraries(msvcp${D_SUFFIX}_atomic_wait PRIVATE msvcp${D_SUFFIX}_atomic_wait_objects msvcp${D_SUFFIX}_satellite_objects msvcp${D_SUFFIX}_implib_objects "msvcp${D_SUFFIX}" "${TOOLSET_LIB}/vcruntime${D_SUFFIX}.lib" "${TOOLSET_LIB}/msvcrt${D_SUFFIX}.lib" "ucrt${D_SUFFIX}.lib" "advapi32.lib")
set_target_properties(msvcp${D_SUFFIX}_atomic_wait PROPERTIES ARCHIVE_OUTPUT_NAME "msvcp140_atomic_wait${D_SUFFIX}${VCLIBS_SUFFIX}")
set_target_properties(msvcp${D_SUFFIX}_atomic_wait PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
set_target_properties(msvcp${D_SUFFIX}_atomic_wait PROPERTIES OUTPUT_NAME "${_ATOMIC_WAIT_OUTPUT_NAME}")
Expand Down
154 changes: 154 additions & 0 deletions stl/inc/__msvc_tzdb.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
// __msvc_tzdb.hpp internal header

// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#pragma once
#ifndef __MSVC_TZDB_HPP
#define __MSVC_TZDB_HPP
#include <yvals.h>
#if _STL_COMPILER_PREPROCESSOR
#include <cstddef>
#include <cstdint>
#include <type_traits>
#include <xutility>

#pragma pack(push, _CRT_PACKING)
#pragma warning(push, _STL_WARNING_LEVEL)
#pragma warning(disable : _STL_DISABLED_WARNINGS)
_STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new

using __std_tzdb_epoch_milli = double;

struct __std_tzdb_leap_info {
uint16_t _Year;
uint16_t _Month;
uint16_t _Day;
uint16_t _Hour;
uint16_t _Negative;
uint16_t _Reserved;
};

enum class __std_tzdb_error {
_Success = 0,
_Win_error = 1,
_Icu_error = 2,
};

struct __std_tzdb_time_zones_info {
__std_tzdb_error _Err;
// timezone data version currently being used
const char* _Version;
size_t _Num_time_zones;
// ordered list of null-terminated time_zone/time_zone_link names
const char** _Names;
// contains corresponding entry for every name, if:
// (_Links[i] == nullptr) then _Names[i] is a time_zone
// (_Links[i] != nullptr) then _Names[i] is a time_zone_link to time_zone with name _Links[i]
const char** _Links;
};

struct __std_tzdb_current_zone_info {
__std_tzdb_error _Err;
const char* _Tz_name;
};

struct __std_tzdb_sys_info {
__std_tzdb_error _Err;
__std_tzdb_epoch_milli _Begin;
__std_tzdb_epoch_milli _End;
int32_t _Offset;
int32_t _Save;
const char* _Abbrev;
};

_EXTERN_C

_NODISCARD __std_tzdb_time_zones_info* __stdcall __std_tzdb_get_time_zones() noexcept;
void __stdcall __std_tzdb_delete_time_zones(__std_tzdb_time_zones_info* _Info) noexcept;

_NODISCARD __std_tzdb_current_zone_info* __stdcall __std_tzdb_get_current_zone() noexcept;
void __stdcall __std_tzdb_delete_current_zone(__std_tzdb_current_zone_info* _Info) noexcept;

_NODISCARD __std_tzdb_sys_info* __stdcall __std_tzdb_get_sys_info(
const char* _Tz, size_t _Tz_len, __std_tzdb_epoch_milli _Local) noexcept;
void __stdcall __std_tzdb_delete_sys_info(__std_tzdb_sys_info* _Info) noexcept;

_NODISCARD __std_tzdb_leap_info* __stdcall __std_tzdb_get_leap_seconds(
size_t _Prev_ls_size, size_t* _Current_ls_size) noexcept;
void __stdcall __std_tzdb_delete_leap_seconds(__std_tzdb_leap_info* _Info) noexcept;

_NODISCARD void* __stdcall __std_calloc_crt(size_t _Count, size_t _Size) noexcept;
void __stdcall __std_free_crt(void* _Ptr) noexcept;

_END_EXTERN_C

_STD_BEGIN

template <class _Ty>
struct _Tzdb_deleter;

template <>
struct _Tzdb_deleter<__std_tzdb_time_zones_info> {
void operator()(__std_tzdb_time_zones_info* _Info) const noexcept {
__std_tzdb_delete_time_zones(_Info);
}
};

template <>
struct _Tzdb_deleter<__std_tzdb_current_zone_info> {
void operator()(__std_tzdb_current_zone_info* _Info) const noexcept {
__std_tzdb_delete_current_zone(_Info);
}
};

template <>
struct _Tzdb_deleter<__std_tzdb_sys_info> {
void operator()(__std_tzdb_sys_info* _Info) const noexcept {
__std_tzdb_delete_sys_info(_Info);
}
};

template <>
struct _Tzdb_deleter<__std_tzdb_leap_info[]> {
void operator()(__std_tzdb_leap_info* _Info) const noexcept {
__std_tzdb_delete_leap_seconds(_Info);
}
};

template <class _Ty>
class _Crt_allocator {
public:
using value_type = _Ty;
using propagate_on_container_move_assignment = true_type;
using is_always_equal = true_type;

constexpr _Crt_allocator() noexcept = default;

constexpr _Crt_allocator(const _Crt_allocator&) noexcept = default;
template <class _Other>
constexpr _Crt_allocator(const _Crt_allocator<_Other>&) noexcept {}

_NODISCARD __declspec(allocator) _Ty* allocate(_CRT_GUARDOVERFLOW const size_t _Count) {
const auto _Ptr = __std_calloc_crt(_Count, sizeof(_Ty));
if (!_Ptr) {
_Xbad_alloc();
}
return static_cast<_Ty*>(_Ptr);
}

void deallocate(_Ty* const _Ptr, size_t) noexcept {
__std_free_crt(_Ptr);
}
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm disturbed by having a _Meow_allocator type in product code that doesn't satisfy the allocator requirements. It might be overkill to actually implement template <class _Ty1, class _Ty2> bool operator==(const _Crt_allocator<_Ty1>&, const _Crt_allocator<_Ty2>&), however - could we at least have a comment to the effect that this isn't really an allocator because == is missing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to have a properly implemented == (as product code should hold itself to a high standard), even though we aren't actually using it yet.


_STD_END

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma pack(pop)
#endif // _STL_COMPILER_PREPROCESSOR
#endif // __MSVC_TZDB_HPP
Loading