C++ Chrono Time Library Tutorial In 12minutes ⌛

preview_player
Показать описание
The Chrono Library has three major concepts, duration, time points and clocks. the two clocks that most programmers will use would be either steady_clock or system_clock, one being used for measuring high precision performance while the other is useful for dates and times. To make a simple timer I'll go over all of the concepts in this library to help you better understand how the library works.

Checkout this cppcon talk

Give me money:

Below are affiliate links, I may earn something if you purchase the mentioned product or service linked.

📚 Recommended Books

💵 Get $100 in credits from Vultr with this link

0:00 Intro
0:52 durations
4:26 time points
5:08 clocks
5:26 building a simple timer
Рекомендации по теме
Комментарии
Автор

At 1:37 you can save around 5s of runtime if you optimise your code by setting five_seconds = 0s;

blablabla
Автор

Conversion between units time is straight forward in cpp, took me 30 mins to absorb this. I love cpp❤

Sobioytccc
Автор

first you print: test\n
second test : test_\n(extra space)
Maybe that's why there is a difference in speed.

Андрей_Гурьянов
Автор

Pretty helpful. I strongly suggest using auto less for a tutorial like this since typing is an important part of understanding what is happening.

WobblePizza
Автор

Thank-you so so much. You save my life 😊
From 🇩🇿 Algeria

inesines
Автор

The mistake you make is that you cannot compare the measurements. You need to do each test say a thousend times and calculate the average. As you are working on a multi tasking system you do not know how much time each test gets. Doing only one test run can give misleading numbers. The first run showed axactly the oposite result. But your info on how to use it is super. Thank you.

FritsvanDoorn
Автор

this video is more of a documentation than a tutorial

husenpatel
Автор

In C this requires the assistance of a scheduler. In fact it's not possible without an onboard PIT.

TheRojo
Автор

Hello, a tutorial on the fmt library one day??(PS: You should have mentioned that the days keyword is a c+++20 feature...)

dibyojyotibhattacherjee
Автор

maybe because you had a space after test with the new line character test?

jacko
Автор

Compiler may have optimised std::endl out. Also, I personally consider "using namespace" to be a bad and lazy habit which can cause issues if you use many libraries in a project.

TheBunzinator
Автор

which compiler are you using ??? DEV C++ compiler not working with your codes

terthumofficialculturalgro
Автор

Hi im kinda new in c++.... It says that in chrono.hpp there are some undefined types... Any advice? (ratio is not defined as well if it can be helpful) Does chrono relies on other files?

jamesscotti
Автор

Hello dude, what's your take on installing third party libraries in c/c++??

dibyojyotibhattacherjee
Автор

5:15 duration_cast<days> not working??

sjb