Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions library/timing.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct _hr_time {
#include <time.h>
#include <sys/time.h>
struct _hr_time {
struct timeval start;
clock_t start;
};
#endif /* _WIN32 && !EFIX64 && !EFI32 */

Expand Down Expand Up @@ -88,15 +88,11 @@ unsigned long mbedtls_timing_get_timer(struct mbedtls_timing_hr_time *val, int r
struct _hr_time *t = (struct _hr_time *) val;

if (reset) {
gettimeofday(&t->start, NULL);
t->start = clock();
return 0;
} else {
unsigned long delta;
struct timeval now;
gettimeofday(&now, NULL);
delta = (now.tv_sec - t->start.tv_sec) * 1000ul
+ (now.tv_usec - t->start.tv_usec) / 1000;
return delta;
clock_t now = clock();
return (now - t->start) / (CLOCKS_PER_SEC * 1000ul);
}
}

Expand Down