CppCon 2016: Howard Hinnant “A <chrono> Tutorial'

preview_player
Показать описание


This talk starts very simple: with seconds. It explains exactly what a second is: what is under the hood, what it can do, and most importantly how and why it fails at compile time. Failing at compile time, instead of at run time is the critical design philosophy that runs through chrono.

Slowly the talk adds complexity: other units of time duration, custom time durations, conversions among durations, points in time, etc. With each addition, another layer of the chrono onion is peeled away.

By the end of the talk, you will understand both the importance of the simplicity of chrono, and the power available to you if you avoid the typical mistakes beginners make when first learning chrono. Even experts will find at least one undiscovered gem in this talk to take back to their own code. And you may see ways to transfer some of the chrono design principles into your own designs.

People who attend this talk will be especially well prepared for my later talk about time zones.


Howard Hinnant
Senior Software Engineer, Ripple


*-----*
*-----*
Рекомендации по теме
Комментарии
Автор

I had no idea <chrono> was so straightforward!
Every time I had seen it used, I got spooked by the long type names, but now I see it’s not that complicated to use!
And an absolutely fantastic talk as well! It certainly is a great skill to make this much information easily digestible.

ultradude
Автор

I used to think <chrono> was okay. It's clearly better than okay.

origamibulldoser
Автор

chrono is one of the best things in recent C++ progress, which makes life much easier.

christianczechP
Автор

Hands down, the best library tutorial I have ever seen.

EH-tyko
Автор

Before watching this video, I never thought chrono is so good. It would be great if there is similar implementation for Si Units.

EgD
Автор

This might the best presentation title I've ever seen. "It's about time" is just awesome!

ProfessorWaltherKotz
Автор

The epoch change for system_clock announced by VS in the Q&A period of this talk has been rescinded. And the C++20 draft spec now specifies the system_clock epoch to existing practice (1970) so that it can be officially depended upon.

howardhinnant
Автор

Never thought talking about seconds could be so interesting

umnofff
Автор

Nice talk.
It is mainly 2 parts:
part 1, duraton:
what duration is and what is under the hood and how much it cost (the same as builtin types)
how to convert (self-defined) durations and how it works
warn us when to use duration_cast, accuracy loss

part 2, time point and clock:
what is time point and time point operations, relation with duration -- tp +- tp => duration, tp +- duration => tp
what is clocks, how they generate time point.

gavinchou
Автор

The explanation of the chrono library is so beautifully done, Thanks❤

cyrilemeka
Автор

This talk was simply remarkable! Thank you Howard for this amazing presentation!

emm
Автор

A really comprehensive "chrono" tutorial. Going to bookmark this.

honey_sukesan
Автор

I can only imagine how great a Boost.Units replacement based on the chrono library would be. But for now I'm looking forward to getting a standard datetime library.

knedlsepp
Автор

I LITERALLY just saw this dude on stack overflow.

milespiano
Автор

This was very helpful, I was struggling through error codes and stack overflow answers that didn’t quite line up to what I needed. Thanks!!

justinkovacich
Автор

I am going to look for all sorts of excuses to use chrono now. This is great! :)

wesofx
Автор

std::vector does value initialise it's elements. Therefore it will zero a vector of std::chrono::second or anything else by default.

jamesflames
Автор

I'm so used with convoluted date's library from other languages(I'm speaking of you javascript) . That I struggled with std::chrono trying to make things complicated without any reason. It's pretty straight forward, duration_cast it's being handy in my implementations.

yrds
Автор

C++ libraries like std::chrono are the biggest argument for C++ against C. All the safeties and convenience without any loss of performance.

aniketbisht
Автор

One thing i would want is that the output stream operator<< to print based on the type. for seconds it should print 3s, milliseconds 3ms, y(sec+milliseconds) yms.

wpavada