- refactored to modular structure
This commit is contained in:
32
src/ext/xtime.h
Normal file
32
src/ext/xtime.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*!
|
||||
* @file xtime.h
|
||||
* @brief Provides additional definitions for working with delays
|
||||
*
|
||||
* Project: \n
|
||||
* Subsystem: \n
|
||||
* Module: mst\n
|
||||
* Code: GNU-C\n
|
||||
*
|
||||
* @date 08.06.2016
|
||||
* @author SESA354004
|
||||
*/
|
||||
#ifndef XTIME_H_
|
||||
#define XTIME_H_
|
||||
|
||||
#include <time.h>
|
||||
|
||||
/*! @brief Convert milliseconds to nanoseconds */
|
||||
#define XTIME_MSTONS(milliseconds) (milliseconds * 1000000L)
|
||||
/*! @brief Convert microseconds to nanoseconds */
|
||||
#define XTIME_USTONS(microseconds) (microseconds * 1000L)
|
||||
/*! @brief Convert nanoseconds to milliseconds*/
|
||||
#define XTIME_NSTOMS(nanoseconds) (nanoseconds / 1000000L)
|
||||
/*! @brief Convert nanoseconds to microseconds*/
|
||||
#define XTIME_NSTOUS(nanoseconds) (nanoseconds / 1000L)
|
||||
|
||||
/*! @brief Only microseconds up to 1000000 are supported */
|
||||
#define XTIME_TIMESPEC_US(seconds, microseconds) (const struct timespec[]){{seconds, XTIME_USTONS(microseconds)}}
|
||||
/*! @brief Only milliseconds up to 1000 are supported */
|
||||
#define XTIME_TIMESPEC_MS(seconds, milliseconds) (const struct timespec[]){{seconds, XTIME_MSTONS(milliseconds)}}
|
||||
|
||||
#endif /* XTIME_H_ */
|
Reference in New Issue
Block a user