QSC Post Quantum Cryptographic Library 1.0.0.6c (A6)
A post quantum secure library written in Ansi C
 
Loading...
Searching...
No Matches
timerex.h File Reference

System Time Measurement Functions. More...

#include "common.h"
#include <time.h>

Go to the source code of this file.

Macros

#define QSC_TIMEREX_TIMESTAMP_MAX   80ULL
 The maximum time-stamp array size.
 

Functions

QSC_EXPORT_API void qsc_timerex_get_date (char output[QSC_TIMEREX_TIMESTAMP_MAX])
 Get the calendar date from the current locale.
 
QSC_EXPORT_API void qsc_timerex_get_datetime (char output[QSC_TIMEREX_TIMESTAMP_MAX])
 Get the calendar date and time from the current locale.
 
QSC_EXPORT_API void qsc_timerex_get_time (char output[QSC_TIMEREX_TIMESTAMP_MAX])
 Get the local time.
 
QSC_EXPORT_API uint64_t qsc_timerex_stopwatch_start (void)
 Returns the clock time at the start of a timed operation.
 
QSC_EXPORT_API uint64_t qsc_timerex_stopwatch_elapsed (uint64_t start)
 Returns the time difference between the start and current time in milliseconds.
 

Detailed Description

System Time Measurement Functions.

This header provides common time measurement functions for retrieving the current date, time, and high-resolution timestamps from the system clock. It offers functions to obtain the current calendar date, time, and to compute elapsed time intervals (in milliseconds) using a stopwatch mechanism. These functions facilitate performance measurements and time-based operations in a cross-platform manner.

// Example: Retrieving and printing the current date and elapsed time.
#define TIMESTAMP_SIZE QSC_TIMEREX_TIMESTAMP_MAX
char date[TIMESTAMP_SIZE];
printf("Current Date: %s\n", date);
uint64_t start = qsc_timerex_stopwatch_start();
// ... perform some operations ...
uint64_t elapsed = qsc_timerex_stopwatch_elapsed(start);
printf("Elapsed Time: %llu ms\n", (unsigned long long)elapsed);
QSC_EXPORT_API void qsc_timerex_get_date(char output[QSC_TIMEREX_TIMESTAMP_MAX])
Get the calendar date from the current locale.
Definition timerex.c:7
QSC_EXPORT_API uint64_t qsc_timerex_stopwatch_start(void)
Returns the clock time at the start of a timed operation.
Definition timerex.c:141
QSC_EXPORT_API uint64_t qsc_timerex_stopwatch_elapsed(uint64_t start)
Returns the time difference between the start and current time in milliseconds.
Definition timerex.c:150

Reference Links:

Function Documentation

◆ qsc_timerex_get_date()

QSC_EXPORT_API void qsc_timerex_get_date ( char output[QSC_TIMEREX_TIMESTAMP_MAX])

Get the calendar date from the current locale.

Parameters
output[char*] The output date string

◆ qsc_timerex_get_datetime()

QSC_EXPORT_API void qsc_timerex_get_datetime ( char output[QSC_TIMEREX_TIMESTAMP_MAX])

Get the calendar date and time from the current locale.

Parameters
output[char*] The output time and date string

◆ qsc_timerex_get_time()

QSC_EXPORT_API void qsc_timerex_get_time ( char output[QSC_TIMEREX_TIMESTAMP_MAX])

Get the local time.

Parameters
output[char*] The output time string

◆ qsc_timerex_stopwatch_elapsed()

QSC_EXPORT_API uint64_t qsc_timerex_stopwatch_elapsed ( uint64_t start)

Returns the time difference between the start and current time in milliseconds.

Returns
[uint64_t] The time difference in milliseconds

◆ qsc_timerex_stopwatch_start()

QSC_EXPORT_API uint64_t qsc_timerex_stopwatch_start ( void )

Returns the clock time at the start of a timed operation.

Returns
[uint64_t] The starting clock time