UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Chrono.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "Core/Types.h"
5
6#ifdef CADKERNEL_DEV
7#include <chrono>
8#include <string>
9#include <utility>
10#endif
11
12namespace UE::CADKernel
13{
14enum class ETimeUnit : uint8
15{
16 NanoSeconds = 0,
17 MicroSeconds = 1,
20};
21
22#ifdef CADKERNEL_DEV
23typedef std::chrono::high_resolution_clock::time_point FTimePoint;
24typedef std::chrono::high_resolution_clock::duration FDuration;
25#else
28#endif
29
31{
32 ETimeUnit DefaultUnit = ETimeUnit::NanoSeconds;
33public:
34 static const FTimePoint Now()
35 {
36#ifdef CADKERNEL_DEV
37 return std::chrono::high_resolution_clock::now();
38#else
39 return 0;
40#endif
41 }
42
43 static const FDuration Elapse(FTimePoint StartTime)
44 {
45#ifdef CADKERNEL_DEV
46 return (std::chrono::high_resolution_clock::now() - StartTime);
47#else
48 return 0;
49#endif
50 }
51
52 static const FDuration Init()
53 {
54#ifdef CADKERNEL_DEV
55 return FDuration();
56#else
57 return 0;
58#endif
59 }
60
61 template<typename Unit>
63 {
64#ifdef CADKERNEL_DEV
65 return std::chrono::duration_cast<Unit>(Duration).count();
66#else
67 return 0;
68#endif
69 }
70
71 static void PrintClockElapse(EVerboseLevel Level, const TCHAR* Indent, const TCHAR* Process, FDuration Duration, ETimeUnit Unit = ETimeUnit::MicroSeconds);
72};
73}
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition Chrono.h:31
static const FDuration Elapse(FTimePoint StartTime)
Definition Chrono.h:43
static const FTimePoint Now()
Definition Chrono.h:34
static int64 ConvertInto(FDuration Duration)
Definition Chrono.h:62
static const FDuration Init()
Definition Chrono.h:52
Definition CADEntity.cpp:23
uint64 FDuration
Definition Chrono.h:27
ETimeUnit
Definition Chrono.h:15
uint64 FTimePoint
Definition Chrono.h:26
EVerboseLevel
Definition Types.h:104