Topic: Encapsulate std::tm in std::chrono::time_point<>


Author: Howard Hinnant <howard.hinnant@gmail.com>
Date: Mon, 29 Aug 2016 18:05:53 -0400
Raw View
--Apple-Mail=_353293A5-C794-4EB0-AD75-E153AAA66F44
Content-Type: text/plain; charset=UTF-8

On Aug 29, 2016, at 5:54 PM, HarD Gamer <rodrigojose690@gmail.com> wrote:
>
>
>
> Now, if we need a textual representation of a time_point or the current hour, we have a lot of work to do.
> If we had a intuitive  time_point<...> now; .... now.sec(); now.min(); now.hour(); now.day(); now.month(); now.year(); ... [or now.tm()].
> the work would be more readably and fun.
> And what about a simple now.to_string()?

How do you feel about this:

    #include "tz.h"
    #include <iostream>

    int
    main()
    {
        using namespace date;
        using namespace std;
        using namespace std::chrono_literals;
        auto ineedhours3 = make_zoned(current_zone(),
                                      floor<chrono::seconds>(chrono::system_clock::now()));
        cout << "The time is " << format("%a %b %d %T %Y\n", ineedhours3);
        auto lt = ineedhours3.get_local_time();
        auto h = make_time(lt - floor<days>(lt)).hours();
        if (h > 18h)
            cout << "Let's to party!!\n";
        else
            cout << "The party is comming..\n";
    }

?

https://github.com/HowardHinnant/date

Howard

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/A87786B6-D6E5-4E97-A393-0E77D4583CE5%40gmail.com.

--Apple-Mail=_353293A5-C794-4EB0-AD75-E153AAA66F44
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename=signature.asc
Content-Type: application/pgp-signature;
 name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----

iQIcBAEBCAAGBQJXxLHBAAoJEGbcHCxKqhWCj88QAKadMIxn0lUAWBbCAchH8o25
WkPjMfimWFivi5oh54QAkM9eAQyxZlXFjexiZm3/icaXaHlVrie+v4fV/1ThviDs
cacGTDqZzJsH/PJFrgrEUatOL1q/LQlSGsUbfDoEAwoBXZ8Bf6mzTHTI0LDgo8kd
uM9St1/eYwyOpqpVfv6sdEEyu4FfqyFaVWgHA4h9Mg5CnrG3XZxQjm6/gYnK3pxL
tuCCBaaskSQ9Z0lpnbY+7lzbKNxGUpwI3ynecaOOmVzsS5Hy57yM7UmkdxHn4SIX
APZuXIAcs4HXu31JR2j1EtSQ7DcTmxa807gosfbYU32S56R/lf2mTa8OojS4lgVy
xg6nmeEYTamJkKr5AO9AhMvn1opIstZLcDAbWkR9TuMfFhpiiJ5/h3mc1EyoFtjJ
+WNu0Ca1cQX8VWsWmmYeA+9FQaIyX/RI6mhXZTw4IcV0Jzu3Z8P6Lxp/qieodLK/
HHcjKgu59NAdNxdMU6O8rO4aZCRH+8eNEP29LrvRDfsoCI9de9q8sKHtnh0RRD6C
xZhJXB8qF+vNx9XnOBTv98IO3WZY9kA0wTjMFDtKDjko+dOlDJ9arCb8VpT3DcsX
MddFavvuONt2Jk1jUBo66ive4mP4veE0jseaWfVBI7QznGDxMCLCudn/8uBwOrlc
TL2oj5aji5kuPLSbOZ5V
=2qaK
-----END PGP SIGNATURE-----

--Apple-Mail=_353293A5-C794-4EB0-AD75-E153AAA66F44--

.


Author: =?UTF-8?Q?Jos=C3=A9_Rodrigo?= <rodrigojose690@gmail.com>
Date: Mon, 29 Aug 2016 19:07:42 -0300
Raw View
--001a1144d6f6dba2cb053b3d1781
Content-Type: text/plain; charset=UTF-8

good man

2016-08-29 19:05 GMT-03:00 Howard Hinnant <howard.hinnant@gmail.com>:

> On Aug 29, 2016, at 5:54 PM, HarD Gamer <rodrigojose690@gmail.com> wrote:
> >
> >
> >
> > Now, if we need a textual representation of a time_point or the current
> hour, we have a lot of work to do.
> > If we had a intuitive  time_point<...> now; .... now.sec(); now.min();
> now.hour(); now.day(); now.month(); now.year(); ... [or now.tm()].
> > the work would be more readably and fun.
> > And what about a simple now.to_string()?
>
> How do you feel about this:
>
>     #include "tz.h"
>     #include <iostream>
>
>     int
>     main()
>     {
>         using namespace date;
>         using namespace std;
>         using namespace std::chrono_literals;
>         auto ineedhours3 = make_zoned(current_zone(),
>                                       floor<chrono::seconds>(chrono:
> :system_clock::now()));
>         cout << "The time is " << format("%a %b %d %T %Y\n", ineedhours3);
>         auto lt = ineedhours3.get_local_time();
>         auto h = make_time(lt - floor<days>(lt)).hours();
>         if (h > 18h)
>             cout << "Let's to party!!\n";
>         else
>             cout << "The party is comming..\n";
>     }
>
> ?
>
> https://github.com/HowardHinnant/date
>
> Howard
>
> --
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> To view this discussion on the web visit https://groups.google.com/a/
> isocpp.org/d/msgid/std-proposals/A87786B6-D6E5-4E97-
> A393-0E77D4583CE5%40gmail.com.
>

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAJe%2Baq9ai-qdC-02KYBqhg9u1kDzUeS%2BtK4yWdj2KDvRm0Vhow%40mail.gmail.com.

--001a1144d6f6dba2cb053b3d1781
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">good man</div><div class=3D"gmail_extra"><br><div class=3D=
"gmail_quote">2016-08-29 19:05 GMT-03:00 Howard Hinnant <span dir=3D"ltr">&=
lt;<a href=3D"mailto:howard.hinnant@gmail.com" target=3D"_blank">howard.hin=
nant@gmail.com</a>&gt;</span>:<br><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span cl=
ass=3D"">On Aug 29, 2016, at 5:54 PM, HarD Gamer &lt;<a href=3D"mailto:rodr=
igojose690@gmail.com">rodrigojose690@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Now, if we need a textual representation of a time_point or the curren=
t hour, we have a lot of work to do.<br>
&gt; If we had a intuitive=C2=A0 time_point&lt;...&gt; now; .... now.sec();=
 now.min(); now.hour(); now.day(); now.month(); now.year(); ... [or <a href=
=3D"http://now.tm" rel=3D"noreferrer" target=3D"_blank">now.tm</a>()].<br>
&gt; the work would be more readably and fun.<br>
&gt; And what about a simple now.to_string()?<br>
<br>
</span>How do you feel about this:<br>
<br>
=C2=A0 =C2=A0 #include &quot;tz.h&quot;<br>
=C2=A0 =C2=A0 #include &lt;iostream&gt;<br>
<br>
=C2=A0 =C2=A0 int<br>
=C2=A0 =C2=A0 main()<br>
=C2=A0 =C2=A0 {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 using namespace date;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 using namespace std;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 using namespace std::chrono_literals;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 auto ineedhours3 =3D make_zoned(current_zone(),=
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 floor&lt;chrono=
::seconds&gt;(chrono:<wbr>:system_clock::now()));<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 cout &lt;&lt; &quot;The time is &quot; &lt;&lt;=
 format(&quot;%a %b %d %T %Y\n&quot;, ineedhours3);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 auto lt =3D ineedhours3.get_local_time();<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 auto h =3D make_time(lt - floor&lt;days&gt;(lt)=
).hours();<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (h &gt; 18h)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cout &lt;&lt; &quot;Let&#39;s to =
party!!\n&quot;;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 else<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cout &lt;&lt; &quot;The party is =
comming..\n&quot;;<br>
=C2=A0 =C2=A0 }<br>
<br>
?<br>
<br>
<a href=3D"https://github.com/HowardHinnant/date" rel=3D"noreferrer" target=
=3D"_blank">https://github.com/<wbr>HowardHinnant/date</a><br>
<br>
Howard<br>
<span class=3D""><br>
--<br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org">std-propo=
sals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
</span>To view this discussion on the web visit <a href=3D"https://groups.g=
oogle.com/a/isocpp.org/d/msgid/std-proposals/A87786B6-D6E5-4E97-A393-0E77D4=
583CE5%40gmail.com" rel=3D"noreferrer" target=3D"_blank">https://groups.goo=
gle.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/A87786B6-D6E5-4E97-<wb=
r>A393-0E77D4583CE5%40gmail.com</a>.<br>
</blockquote></div><br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAJe%2Baq9ai-qdC-02KYBqhg9u1kDzUeS%2B=
tK4yWdj2KDvRm0Vhow%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAJe%2Baq9ai-=
qdC-02KYBqhg9u1kDzUeS%2BtK4yWdj2KDvRm0Vhow%40mail.gmail.com</a>.<br />

--001a1144d6f6dba2cb053b3d1781--

.


Author: Tony V E <tvaneerd@gmail.com>
Date: Mon, 29 Aug 2016 18:14:22 -0400
Raw View
--94eb2c06cbe2b40316053b3d2f49
Content-Type: text/plain; charset=UTF-8

I'm still confused (although maybe it is all the 'auto's such that I don't
know what is what)
see below:

On Mon, Aug 29, 2016 at 6:05 PM, Howard Hinnant <howard.hinnant@gmail.com>
wrote:

>
> How do you feel about this:
>
>     #include "tz.h"
>     #include <iostream>
>
>     int
>     main()
>     {
>         using namespace date;
>         using namespace std;
>         using namespace std::chrono_literals;
>         auto ineedhours3 = make_zoned(current_zone(),
>                                       floor<chrono::seconds>(chrono:
> :system_clock::now()));
>         cout << "The time is " << format("%a %b %d %T %Y\n", ineedhours3);
>

OK, it seems like ineedhours3 is some type of timey-wimey thing that has
what I need (ie hours).
Why do I need these next two lines:


>         auto lt = ineedhours3.get_local_time();
>         auto h = make_time(lt - floor<days>(lt)).hours();
>

In particular, make_time()? Ain't nobody got time for that. Didn't I
already have a time thing?  It also looks like magic. floor<days>...


>         if (h > 18h)
>             cout << "Let's to party!!\n";
>         else
>             cout << "The party is comming..\n";
>     }
>
> ?
>
> https://github.com/HowardHinnant/date
>
> Howard
>
>

--
Be seeing you,
Tony

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOHCbisL0PX8rYKKbVLWLC4mUcDYTj6OEvLsNr%2Bf1_41n%2Bwiyg%40mail.gmail.com.

--94eb2c06cbe2b40316053b3d2f49
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I&#39;m still confused (although maybe it is all the =
&#39;auto&#39;s such that I don&#39;t know what is what)<br></div>see below=
:<br><div><div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On=
 Mon, Aug 29, 2016 at 6:05 PM, Howard Hinnant <span dir=3D"ltr">&lt;<a href=
=3D"mailto:howard.hinnant@gmail.com" target=3D"_blank">howard.hinnant@gmail=
..com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=3D=
""><br>
</span>How do you feel about this:<br>
<br>
=C2=A0 =C2=A0 #include &quot;tz.h&quot;<br>
=C2=A0 =C2=A0 #include &lt;iostream&gt;<br>
<br>
=C2=A0 =C2=A0 int<br>
=C2=A0 =C2=A0 main()<br>
=C2=A0 =C2=A0 {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 using namespace date;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 using namespace std;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 using namespace std::chrono_literals;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 auto ineedhours3 =3D make_zoned(current_zone(),=
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 floor&lt;chrono=
::seconds&gt;(chrono:<wbr>:system_clock::now()));<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 cout &lt;&lt; &quot;The time is &quot; &lt;&lt;=
 format(&quot;%a %b %d %T %Y\n&quot;, ineedhours3);<br></blockquote><div><b=
r></div><div>OK, it seems like ineedhours3 is some type of timey-wimey thin=
g that has what I need (ie hours).<br></div><div>Why do I need these next t=
wo lines:<br>=C2=A0<br></div><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
=C2=A0 =C2=A0 =C2=A0 =C2=A0 auto lt =3D ineedhours3.get_local_time();<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 auto h =3D make_time(lt - floor&lt;days&gt;(lt)=
).hours();<br></blockquote><div><br></div><div>In particular, make_time()? =
Ain&#39;t nobody got time for that. Didn&#39;t I already have a time thing?=
=C2=A0 It also looks like magic. floor&lt;days&gt;...<br></div><div>=C2=A0<=
/div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-le=
ft:1px #ccc solid;padding-left:1ex">
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (h &gt; 18h)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cout &lt;&lt; &quot;Let&#39;s to =
party!!\n&quot;;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 else<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cout &lt;&lt; &quot;The party is =
comming..\n&quot;;<br>
=C2=A0 =C2=A0 }<br>
<br>
?<br>
<br>
<a href=3D"https://github.com/HowardHinnant/date" rel=3D"noreferrer" target=
=3D"_blank">https://github.com/<wbr>HowardHinnant/date</a><br>
<br>
Howard<br>
<span class=3D""></span><br></blockquote></div><br clear=3D"all"><br>-- <br=
><div class=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div dir=
=3D"ltr"><div>Be seeing you,<br></div>Tony<br></div></div>
</div></div></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAOHCbisL0PX8rYKKbVLWLC4mUcDYTj6OEvLs=
Nr%2Bf1_41n%2Bwiyg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOHCbisL0PX8=
rYKKbVLWLC4mUcDYTj6OEvLsNr%2Bf1_41n%2Bwiyg%40mail.gmail.com</a>.<br />

--94eb2c06cbe2b40316053b3d2f49--

.


Author: Howard Hinnant <howard.hinnant@gmail.com>
Date: Mon, 29 Aug 2016 18:29:15 -0400
Raw View
--Apple-Mail=_4B4BFBEB-6497-4B81-9512-61B9267E98CC
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8

On Aug 29, 2016, at 6:14 PM, Tony V E <tvaneerd@gmail.com> wrote:
>=20
> I'm still confused (although maybe it is all the 'auto's such that I don'=
t know what is what)
> see below:

Fortunately there are docs:

https://howardhinnant.github.io/date/tz.html
https://howardhinnant.github.io/date/date.html

(not that you should=E2=80=99ve run out and immediately read and understood=
 all that, just giving handy links)

>=20
>> On Mon, Aug 29, 2016 at 6:05 PM, Howard Hinnant <howard.hinnant@gmail.co=
m> wrote:
>>=20
>> How do you feel about this:
>>=20
>>     #include "tz.h"
>>     #include <iostream>
>>=20
>>     int
>>     main()
>>     {
>>         using namespace date;
>>         using namespace std;
>>         using namespace std::chrono_literals;
>>         auto ineedhours3 =3D make_zoned(current_zone(),
>>                                       floor<chrono::seconds>(chrono::sys=
tem_clock::now()));
>>         cout << "The time is " << format("%a %b %d %T %Y\n", ineedhours3=
);
>>=20
> OK, it seems like ineedhours3 is some type of timey-wimey thing that has =
what I need (ie hours).
> Why do I need these next two lines:

The type of ineedhours3 is a a zoned_time<seconds>, also known as zoned_sec=
onds for short.

https://howardhinnant.github.io/date/tz.html#zoned_time

A zoned_time is a pairing of a time_zone and local_time.  Or you can equiva=
lently think of it as a pairing of a time_zone and a sys_time.  Either way,=
 it represents a well-specified time in some time zone.  From it you can ge=
t the local time, the UTC time and the time zone.  And you can also format =
it (including %Z (time zone abbreviation) and %z (time zone offset).

>=20
>>         auto lt =3D ineedhours3.get_local_time();
>>         auto h =3D make_time(lt - floor<days>(lt)).hours();
>>=20
> In particular, make_time()? Ain't nobody got time for that. Didn't I alre=
ady have a time thing?  It also looks like magic. floor<days>=E2=80=A6

lt has type local_time<seconds>, or local_seconds for short.  local_time is=
 a std::chrono::time_point that is not associated with _any_ time zone.  On=
e can think of it as the void* of chrono::time_points.

floor<Duration>(time_point) is actually already in the C++1z working draft.=
  It takes a time_point of a finer duration and truncates it to a time_poin=
t of a coarser duration.  In this case the finer duration is seconds, and t=
he coarser duration is days.  days is a chrono::duration<int, ratio<86400>>=
..

The expression =E2=80=9Clt - floor<days>(lt)=E2=80=9D converts a time_point=
 since whatever epoch into a chrono::duration of the time since midnight.  =
Since lt has type local_time, as opposed to being a system_clock::time_poin=
t, this is with respect to local midnight, as opposed to midnight UTC.  We =
could have just as easily gotten time since UTC midnight by extracting inee=
dhours3.get_sys_time(), resulting in a system_clock::time_point with second=
s precision, or sys_seconds for short.

make_time takes a chrono::duration and breaks it down into a {hours, minute=
s, seconds} struct.  It has a .hours() getter to get the hours.  The type o=
f that result is chrono::hours.

>=20
>>         if (h > 18h)
>>             cout << "Let's to party!!\n";
>>         else
>>             cout << "The party is comming..\n";
>>     }
>>=20
>> ?
>>=20
>> https://github.com/HowardHinnant/date
>>=20

Howard


--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/76600B9F-F3DF-4FA4-BE1C-19474389DB08%40gmail.com=
..

--Apple-Mail=_4B4BFBEB-6497-4B81-9512-61B9267E98CC
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename=signature.asc
Content-Type: application/pgp-signature;
 name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----

iQIcBAEBCAAGBQJXxLc8AAoJEGbcHCxKqhWCAZsQALeQxD+1L62MtHFbPPbojtew
lPyPARCPEpX3pg4Elvq19yGGPAJ7Fb75RizZ3EgWJD7j6+/ZhXc38t2mbZxJZLwJ
mZkG9vSaU2VPHHydZYwPd1loaMmHrT5gaE8wUaIHhyLBM7g0bNaQljtSFRLFfT0D
kjYQjECIoFh3kIG/t3vi3K22Aa1PGlsfYf1zodeklHR0Vn4dWKiHgpoen9sY4pkW
bcl9NOHVdnsK6cKfeVK/o/jA7IWHh+QK4esEaxaZm20jC7xJLadjbt25y4W4NPCn
R+Q8xcy9UEnNn5PByk1Upu7OA9F5ckdMlratm8bBAXJUlriaJ+KyT5wCKQgcANB3
kopeN4zCOUbnqMG/OxzX4nAHYp3pUJuV4wMaIphfvWJeh5z/4tCRvbUjuIjc1znB
e9Gau4hkFGkP0Q+JaUY+5sZAw2BOZ4Gp58o0OFGCV6zco/MsZ7Bc9A+XkVX1s5P+
Ef4vbdAhrqv08FeV/oyZAjpANvg0mpguoUBu0KhhXIyComYKXiMuELG1A+ol34gP
egKLQKJ14Ngftj1DP087rdOtq0oMtWZM6IcOde9JvwI1dQjKhQXdfs78Yf80vLOg
FDKEjw19fEkGaLOfRm2T0lHpObJGUHTkdpuN4lVE9aVYaTvFfGN3Iy+xyIFEQnxC
e4JLS3ZMpZuq3Wa/XtfN
=UbiO
-----END PGP SIGNATURE-----

--Apple-Mail=_4B4BFBEB-6497-4B81-9512-61B9267E98CC--

.


Author: Howard Hinnant <howard.hinnant@gmail.com>
Date: Mon, 29 Aug 2016 20:05:21 -0400
Raw View
--Apple-Mail=_E122F84A-C8E5-489D-ABC7-ED338359E56E
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8

On Aug 29, 2016, at 6:29 PM, Howard Hinnant <howard.hinnant@gmail.com> wrot=
e:
>=20
>>>        auto h =3D make_time(lt - floor<days>(lt)).hours();
>>>=20
>> In particular, make_time()? Ain't nobody got time for that. Didn't I alr=
eady have a time thing?  It also looks like magic. floor<days>=E2=80=A6
>=20
> make_time takes a chrono::duration and breaks it down into a {hours, minu=
tes, seconds} struct. It has a .hours() getter to get the hours.  The type =
of that result is chrono::hours.

On further reflection, make_time() really is overkill for this application =
since the minutes and seconds are discarded.  The following is both simpler=
 and slightly more efficient:

        auto h =3D floor<chrono::hours>(lt - floor<days>(lt));

Howard

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/FC69995F-0467-4C8D-B76A-EF661C8AA7EF%40gmail.com=
..

--Apple-Mail=_E122F84A-C8E5-489D-ABC7-ED338359E56E
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename=signature.asc
Content-Type: application/pgp-signature;
 name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----

iQIcBAEBCAAGBQJXxM3CAAoJEGbcHCxKqhWCLuYP/0deY5K94us6TBA5m5yLHH21
0ANi7lGx9nlVrMhGDUC9vrduDA1aTf+o0Ix9uuMviJ8KyojJKFsQWmQj46FkOC3J
++IQRP8KoZFEceU701vDxZpiGpiVSMCGeJu86OEjhlC5G0joXwPuXxLikpfNqi17
l3v8hGm8UF2QB4G3HkST5hn/d/g1DRqALJaRf1hLioP6MU4zHYRrxxQLaG/iQl+R
CYrpwIse+wmcuaF4/Zc/VyPBgYj8s3U9B1TEc5OY6bSNccuZX6oxPFbiMpvqXX8o
0lKBky+FKBVtajx9Xu6GaMgg9WLMUYh6Y+1StU5VgyVTWEpQl3esZuzA13JSBwzl
TmYvBh9xheaQh1htX3jw05SASOHTOyjWdm4cTYxgDwcn0yVbty9uHNbCkmXHmscF
zz8dO3yoZ86Z+27wdLYp0YpSeaLIc8xmNmfBFE1EzHLjgk+eXCCNerU/rLC766k9
TjGpHWt5exR0yhC9o+ux1LvksKX6ou4z3HVRlvw+l9z3pFO1nTnG4MUGHmMXd3sK
2cCMMqoGlrCZrb6P0PVGNBxA/sOnj+jQ+CZF+aMUwBC+0YF9eZ1Wi4tRihVcFIDl
WisF0mftj+Nbkl6EuIM2cHRAI7EzkNH+pZqr9Ksa6aCxmkZDHRyaxtNbWEZTNccb
ZWN+BDJkft706WtGJlS3
=VSpq
-----END PGP SIGNATURE-----

--Apple-Mail=_E122F84A-C8E5-489D-ABC7-ED338359E56E--

.