Skip to content

Commit 2d969df

Browse files
dependabot[bot]RickWinterantkmsft
authored
Bump github.com/microsoft/vcpkg from master to ef7dbf94b9198bc58f45951adcf1f041fcbc5ea0 (#6659)
* Bump github.com/microsoft/vcpkg --- updated-dependencies: - dependency-name: github.com/microsoft/vcpkg dependency-version: ef7dbf94b9198bc58f45951adcf1f041fcbc5ea0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * Update vcpkg.json * Update default VCPKG commit hash in AzureVcpkg.cmake * try fixing CI by updating xcode version * 16.2 -> 16.4 * Fix the reason for overfow warning * Suppress warning C6326: Potential comparison of a constant with another constant. * Undo unintended format * Correct condition to check whether it is possible to add epoch to system clock max without overflow * Insert info for debugging on mac * Better temp log formatting * Use largest int type for calcuations (mac fix) * In case system clock is lesser resolution than Azure::DateTime, do all calculations in a greater ration to avoid integer overflows * Avoid overflowing system clock max when converting to time since epoch * Add one more variable for debug logging on mac * Avoid one more integer overflow * Remove debug stuff * CLang-format * More clang-format * Less conversions if equal * Commit to reset CI * Undo commit to reset CI --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Rick Winter <[email protected]> Co-authored-by: Anton Kolesnyk <[email protected]> Co-authored-by: Anton Kolesnyk <[email protected]>
1 parent bc178b1 commit 2d969df

File tree

4 files changed

+65
-14
lines changed

4 files changed

+65
-14
lines changed

cmake-modules/AzureVcpkg.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ macro(az_vcpkg_integrate)
1818
message("AZURE_SDK_DISABLE_AUTO_VCPKG is not defined. Fetch a local copy of vcpkg.")
1919
# GET VCPKG FROM SOURCE
2020
# User can set env var AZURE_SDK_VCPKG_COMMIT to pick the VCPKG commit to fetch
21-
set(VCPKG_COMMIT_STRING 2c7705e70dcfb70e5f726459c3e399bd780bc1fc) # default SDK tested commit
21+
set(VCPKG_COMMIT_STRING ef7dbf94b9198bc58f45951adcf1f041fcbc5ea0) # default SDK tested commit
2222
if(DEFINED ENV{AZURE_SDK_VCPKG_COMMIT})
2323
message("AZURE_SDK_VCPKG_COMMIT is defined. Using that instead of the default.")
2424
set(VCPKG_COMMIT_STRING "$ENV{AZURE_SDK_VCPKG_COMMIT}") # default SDK tested commit

eng/pipelines/templates/stages/platform-matrix.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"OSConfiguration": {
88
"macos-latest": {
99
"OSVmImage": "env:MACVMIMAGE",
10-
"XCODE_VERSION": "15.4"
10+
"XCODE_VERSION": "16.4"
1111
}
1212
},
1313
"StaticConfigs": {

sdk/core/azure-core/src/datetime.cpp

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <ctime>
1010
#include <iomanip>
1111
#include <limits>
12+
#include <ratio>
1213
#include <sstream>
1314
#include <stdexcept>
1415
#include <type_traits>
@@ -43,16 +44,65 @@ DateTime GetSystemClockEpoch()
4344

4445
DateTime GetMaxDateTime()
4546
{
46-
auto const systemClockMax = std::chrono::duration_cast<DateTime::clock::duration>(
47-
(std::chrono::system_clock::time_point::max)().time_since_epoch())
48-
.count();
47+
#ifdef _MSC_VER
48+
#pragma warning(push)
49+
// warning C6326: Potential comparison of a constant with another constant.
50+
#pragma warning(disable : 6326)
51+
#endif
52+
static_assert(
53+
std::is_same<DateTime::clock::duration::rep, std::chrono::system_clock::duration::rep>::value,
54+
"DateTime::clock::duration::rep must be the same as "
55+
"std::chrono::system_clock::duration::rep");
56+
57+
using Rep = DateTime::clock::duration::rep;
58+
59+
using CommonDuration = std::chrono::duration<
60+
Rep,
61+
std::conditional<
62+
std::ratio_greater<
63+
DateTime::clock::duration::period,
64+
std::chrono::system_clock::duration::period>::value,
65+
DateTime::clock::duration::period,
66+
std::chrono::system_clock::duration::period>::type>;
67+
68+
std::chrono::system_clock::time_point const scEpochTimePoint
69+
= std::chrono::system_clock::time_point();
70+
71+
std::chrono::system_clock::duration const scSystemClockMaxDuration
72+
= (scEpochTimePoint + ((std::chrono::system_clock::time_point::max)() - scEpochTimePoint))
73+
.time_since_epoch();
74+
75+
Rep const commonSystemClockMax
76+
= std::chrono::duration_cast<CommonDuration>(scSystemClockMaxDuration).count();
4977

50-
auto const systemClockEpoch = GetSystemClockEpoch().time_since_epoch().count();
78+
Rep const commonDtClockMax
79+
= std::chrono::duration_cast<CommonDuration>((DateTime::clock::duration::max)()).count();
5180

52-
constexpr auto repMax = (std::numeric_limits<DateTime::clock::duration::rep>::max)();
81+
Rep const dtSystemClockMax = (commonSystemClockMax < commonDtClockMax)
82+
? std::chrono::duration_cast<DateTime::clock::duration>(scSystemClockMaxDuration).count()
83+
: ((DateTime::clock::duration::max)()).count();
84+
85+
Azure::DateTime::duration const dtSystemClockEpochDuration
86+
= GetSystemClockEpoch().time_since_epoch();
87+
88+
Rep const commonSystemClockEpoch
89+
= std::chrono::duration_cast<CommonDuration>(dtSystemClockEpochDuration).count();
90+
91+
Rep const dtSystemClockEpoch
92+
= std::chrono::duration_cast<DateTime::clock::duration>(dtSystemClockEpochDuration).count();
93+
94+
constexpr Rep commonRepMax = std::chrono::duration_cast<CommonDuration>(
95+
DateTime::duration((std::numeric_limits<Rep>::max)()))
96+
.count();
5397

5498
return DateTime(DateTime::time_point(DateTime::duration(
55-
systemClockMax + (std::min)(systemClockEpoch, (repMax - systemClockMax)))));
99+
(commonSystemClockMax < commonRepMax
100+
&& commonSystemClockEpoch < (commonRepMax - commonSystemClockMax))
101+
? (dtSystemClockEpoch + dtSystemClockMax)
102+
: dtSystemClockMax)));
103+
#ifdef _MSC_VER
104+
#pragma warning(pop)
105+
#endif
56106
}
57107

58108
template <typename T>
@@ -422,8 +472,8 @@ DateTime::DateTime(
422472

423473
DateTime::operator std::chrono::system_clock::time_point() const
424474
{
425-
static DateTime SystemClockMin((std::chrono::system_clock::time_point::min)());
426-
static DateTime SystemClockMax(GetMaxDateTime());
475+
static DateTime const SystemClockMin((std::chrono::system_clock::time_point::min)());
476+
static DateTime const SystemClockMax(GetMaxDateTime());
427477

428478
auto outOfRange = 0;
429479
if (*this < SystemClockMin)

vcpkg.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "azure-sdk-for-cpp",
33
"version": "1.5.0",
4-
"builtin-baseline": "2c7705e70dcfb70e5f726459c3e399bd780bc1fc",
4+
"builtin-baseline": "ef7dbf94b9198bc58f45951adcf1f041fcbc5ea0",
55
"dependencies": [
66
{
77
"name": "curl"
@@ -16,7 +16,9 @@
1616
},
1717
{
1818
"name": "opentelemetry-cpp",
19-
"features": ["otlp-http"],
19+
"features": [
20+
"otlp-http"
21+
],
2022
"platform": "!(windows & !static)",
2123
"version>=": "1.3.0"
2224
},
@@ -37,6 +39,5 @@
3739
"platform": "!uwp"
3840
}
3941
],
40-
"overrides": [
41-
]
42+
"overrides": []
4243
}

0 commit comments

Comments
 (0)