Skip to content
Merged
Changes from all commits
Commits
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
53 changes: 53 additions & 0 deletions stl/debugger/STL.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -2312,4 +2312,57 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
</Expand>
</Type>

<Type Name="std::chrono::time_point&lt;std::chrono::system_clock,std::chrono::duration&lt;__int64,std::ratio&lt;1,10000000&gt; &gt; &gt;">
<!--
Same computation as in std::chrono::year_month_day::_Civil_from_days
and https://howardhinnant.github.io/date_algorithms.html#civil_from_days.
-->
<Intrinsic Name="z" Expression="(_MyDur._MyRep / (24 * 60 * 60 * 10000000ull)) + 719468"/>
<Intrinsic Name="era" Expression="(z() &gt;= 0 ? z() : z() - 146096) / 146097"/>
<Intrinsic Name="doe" Expression="(unsigned)(z() - era() * 146097)"/>
<Intrinsic Name="yoe" Expression="(doe() - doe()/1460 + doe()/36524 - doe()/146096) / 365"/>
<Intrinsic Name="doy" Expression="doe() - (365*yoe() + yoe()/4 - yoe()/100)"/>
Copy link
Member

Choose a reason for hiding this comment

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

No change requested: Stylistically, I would have put spaces around all binary operators, as we do in product code (enforced by clang-format). But I can see an argument for the choices here, and I'm not picky enough about visualizer syntax for it to be worth resetting testing.

<Intrinsic Name="mp" Expression="(5*doy() + 2)/153"/>
<Intrinsic Name="day" Expression="doy() - (153*mp()+2)/5 + 1"/>
<Intrinsic Name="month" Expression="mp() &lt; 10 ? mp()+3 : mp()-9"/>
<Intrinsic Name="year" Expression="((long long)yoe()) + era() * 400 + (month() &lt; 2)"/>

<DisplayString Condition="_MyDur._MyRep &gt;= 0">
{year(),d}-{month()/10,d}{month()%10,d}-{day()/10,d}{day()%10,d} {
(_MyDur._MyRep % (24 * 60 * 60 * 10000000ull))/(10 * 60 * 60 * 10000000ull),d
}{
((_MyDur._MyRep % (24 * 60 * 60 * 10000000ull))/(60 * 60 * 10000000ull)) % 10,d
}:{
(_MyDur._MyRep % (60 * 60 * 10000000ull))/(10 * 60 * 10000000ull),d
}{
(_MyDur._MyRep % (10 * 60 * 10000000ull)) / (60 * 10000000ull),d
}:{
(_MyDur._MyRep % (60 * 10000000ull)) / (10 * 10000000ull),d
}{
(_MyDur._MyRep % (10 * 10000000ull)) / 10000000ull,d
}.{
(_MyDur._MyRep % 10000000) / 1000000,d
}{
(_MyDur._MyRep % 1000000) / 100000,d
}{
(_MyDur._MyRep % 100000) / 10000,d
}{
(_MyDur._MyRep % 10000) / 1000,d
}{
(_MyDur._MyRep % 1000) / 100,d
}{
(_MyDur._MyRep % 100) / 10,d
}{
_MyDur._MyRep % 10,d
}
</DisplayString>
<Expand>
<Item Name="[ns/100]">_MyDur._MyRep</Item>
<Item Name="[us]">_MyDur._MyRep/10</Item>
<Item Name="[ms]">_MyDur._MyRep/(10 * 1000)</Item>
<Item Name="[s]">_MyDur._MyRep/(10 * 1000 * 1000)</Item>
<Synthetic Name="[clock]"><DisplayString>UTC</DisplayString></Synthetic>
</Expand>
</Type>

</AutoVisualizer>