# Is there an equivalent library to \<chrono\> in Unreal?

**URL:** <https://forums.unrealengine.com/t/is-there-an-equivalent-library-to-chrono-in-unreal/2148154>\
**Category:** C++\
**Tags:** unreal-engine, CPP, question\
**Created:** [November 24, 2024, 11:32am UTC](https://forums.unrealengine.com/t/is-there-an-equivalent-library-to-chrono-in-unreal/2148154 "2024-11-24T11:32:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [November 24, 2024, 11:32am UTC](https://forums.unrealengine.com/t/is-there-an-equivalent-library-to-chrono-in-unreal/2148154/1 "2024-11-24T11:32:41Z")

</div>

Sometimes I have different functions that return the same result.

I’ve been noticing lately that sometimes the simplest code doesn’t have the best performance.

I wonder if the Unreal library has something similar to \< chrono \> library for performance measurement.

Something like this:

```auto
   // start time measurement
   chrono::time_point<chrono::system_clock> cpu_start = chrono::system_clock::now(); 

   MyTestFunction();

   // end time measurement
   chrono::time_point<chrono::system_clock> cpu_end = chrono::system_clock::now();

auto cpu_total_time_ns = chrono::duration_cast<chrono::nanoseconds>(cpu_end - cpu_start).count();

```

Or should I use the C++ standard library for this?

* * *

NOTE: I know unreal insights exists… and I know how to use it (more or less)…  
But I just want is to compare performance of two different functions.

* * *

Thank you so much!!

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [November 26, 2024, 12:53am UTC](https://forums.unrealengine.com/t/is-there-an-equivalent-library-to-chrono-in-unreal/2148154/2 "2024-11-26T00:53:31Z")

</div>

@Matiati answered my question in this post.

> [@How to implement Events strictly on C++ side?](https://forums.unrealengine.com/t/how-to-implement-events-strictly-on-c-side/380278/3):
>
> Since there are no answers to this question yet I’ve decided to write a TestActor which tests if BlueprintNativeEvents (or in general blueprint events) act as threads or not. My findings are very strange… Here is the header for the actor: [120047-testactorheader.png] And the implementation: The basic idea is to see if the call to NativeFooWithoutReturn() method blocks the execution at beginPlay (and hence also the game). I calculated the time difference to see how l…

FDateTime and FTimeSpan is the key.

Thak you so much!!

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [December 26, 2024, 12:53am UTC](https://forums.unrealengine.com/t/is-there-an-equivalent-library-to-chrono-in-unreal/2148154/3 "2024-12-26T00:53:45Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
