Skip to content

Commit

Permalink
Get chrono time for Timer and LowPowerTimer (ARMmbed#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
LDong-Arm authored Aug 10, 2020
1 parent 0d9f12d commit 69a50de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion APIs_Drivers/Timer_HelloWorld/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
#include "mbed.h"

using namespace std::chrono;

Timer t;

Expand All @@ -12,5 +13,5 @@ int main()
t.start();
printf("Hello World!\n");
t.stop();
printf("The time taken was %f seconds\n", t.read());
printf("The time taken was %llu milliseconds\n", duration_cast<milliseconds>(t.elapsed_time()).count());
}
4 changes: 3 additions & 1 deletion APIs_Drivers/lowpowerTimer_ex_1/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

#include "mbed.h"

using namespace std::chrono;

LowPowerTimer t;

int main()
{
t.start();
printf("Hello World!\n");
t.stop();
printf("The time taken was %f seconds\n", t.read());
printf("The time taken was %llu milliseconds\n", duration_cast<milliseconds>(t.elapsed_time()).count());
}

0 comments on commit 69a50de

Please sign in to comment.