File tree Expand file tree Collapse file tree 2 files changed +36
-3
lines changed
executables/referenceApp/platforms/s32k148evb/bspConfiguration/src/bsp/SystemTimer
platforms/posix/bsp/bspSystemTime/src/bsp/time Expand file tree Collapse file tree 2 files changed +36
-3
lines changed Original file line number Diff line number Diff line change 1010#include " interrupts/SuspendResumeAllInterruptsScopedLock.h"
1111#include " mcu/mcu.h"
1212
13+ #include < etl/chrono.h>
14+
1315namespace
1416{
1517uint32_t const DWT_FREQ_MHZ_RUN = 80U ;
@@ -79,14 +81,27 @@ uint32_t getSystemTicks32Bit(void) { return static_cast<uint32_t>(updateTicks())
7981
8082uint64_t getSystemTimeNs (void ) { return updateTicks () * 1000U / TICK_FREQ_MHZ; }
8183
82- extern " C" uint64_t etl_get_system_time_nanosec () { return getSystemTimeNs (); }
83-
8484uint64_t getSystemTimeUs (void ) { return updateTicks () / TICK_FREQ_MHZ; }
8585
8686uint32_t getSystemTimeUs32Bit (void ) { return static_cast <uint32_t >(updateTicks () / TICK_FREQ_MHZ); }
8787
8888uint64_t getSystemTimeMs (void ) { return updateTicks () / TICK_FREQ_MHZ / 1000U ; }
8989
90+ etl::chrono::high_resolution_clock::rep etl_get_high_resolution_clock ()
91+ {
92+ return etl::chrono::high_resolution_clock::rep{static_cast <int64_t >(getSystemTimeNs ())};
93+ }
94+
95+ etl::chrono::system_clock::rep etl_get_system_clock ()
96+ {
97+ return etl::chrono::system_clock::rep (static_cast <int64_t >(getSystemTimeMs ()));
98+ }
99+
100+ etl::chrono::steady_clock::rep etl_get_steady_clock ()
101+ {
102+ return etl::chrono::steady_clock::rep (static_cast <int64_t >(getSystemTimeMs () / 1000 ));
103+ }
104+
90105uint32_t getSystemTimeMs32Bit (void )
91106{
92107 return static_cast <uint32_t >(updateTicks () / TICK_FREQ_MHZ / 1000U );
Original file line number Diff line number Diff line change 11// Copyright 2024 Accenture.
22
33#include < bsp/timer/SystemTimer.h>
4+ #include < etl/chrono.h>
45
56#include < chrono>
67
@@ -12,7 +13,24 @@ uint64_t getSystemTimeNs()
1213 return duration_cast<nanoseconds>(duration).count ();
1314}
1415
15- extern " C" uint64_t etl_get_system_time_nanosec () { return getSystemTimeNs (); }
16+ extern " C"
17+ {
18+ etl::chrono::high_resolution_clock::rep etl_get_high_resolution_clock ()
19+ {
20+ return etl::chrono::high_resolution_clock::rep{static_cast <int64_t >(getSystemTimeNs ())};
21+ }
22+
23+ etl::chrono::system_clock::rep etl_get_system_clock ()
24+ {
25+ return etl::chrono::system_clock::rep (static_cast <int64_t >(getSystemTimeNs () / 1000 / 1000 ));
26+ }
27+
28+ etl::chrono::steady_clock::rep etl_get_steady_clock ()
29+ {
30+ return etl::chrono::steady_clock::rep (
31+ static_cast <int64_t >(getSystemTimeNs () / 1000 / 1000 / 1000 ));
32+ }
33+ }
1634
1735uint32_t getSystemTimeUs32Bit (void ) { return getSystemTimeNs () / 1000 ; }
1836
You can’t perform that action at this time.
0 commit comments