![]() |
reactor-c 1.0
C Runtime for Lingua Franca
|
Time and tag definitions and functions for Lingua Franca. More...
#include <stdint.h>#include <stddef.h>#include <limits.h>Go to the source code of this file.
Data Structures | |
| struct | tag_t |
| A tag is a time, microstep pair. More... | |
Macros | |
| #define | BILLION ((instant_t)1000000000LL) |
| The number of nanoseconds in one second. | |
| #define | CHECK_TIMEOUT(start, duration) |
| Expression that is true if physical time since start exceeds the duration. | |
| #define | DAY(t) |
| Number of days. | |
| #define | DAYS(t) |
| Number of days. | |
| #define | FOREVER ((interval_t)LLONG_MAX) |
| Time greater than all other times. | |
| #define | FOREVER_MICROSTEP UINT_MAX |
| Largest microstep. | |
| #define | FOREVER_TAG (tag_t) { .time = FOREVER, .microstep = FOREVER_MICROSTEP } |
| Tag later than all other tags. | |
| #define | FOREVER_TAG_INITIALIZER {FOREVER, FOREVER_MICROSTEP} |
| Initializer for tag later than all other tags. | |
| #define | HOUR(t) |
| Number of hours. | |
| #define | HOURS(t) |
| Number of hours. | |
| #define | LF_TIME_BUFFER_LENGTH 64 |
| For user-friendly reporting of time values, the buffer length required. | |
| #define | MINUTE(t) |
| Number of minutes. | |
| #define | MINUTES(t) |
| Number of minutes. | |
| #define | MSEC(t) |
| Number of milliseconds. | |
| #define | MSECS(t) |
| Number of milliseconds. | |
| #define | NEVER ((interval_t)LLONG_MIN) |
| Time earlier than all other times. | |
| #define | NEVER_MICROSTEP 0u |
| Smallest microstep. | |
| #define | NEVER_TAG (tag_t) { .time = NEVER, .microstep = NEVER_MICROSTEP } |
| Tag earlier than all other tags. | |
| #define | NEVER_TAG_INITIALIZER {NEVER, NEVER_MICROSTEP} |
| Initializer for tag earlier than all other tags. | |
| #define | NSEC(t) |
| Number of nanoseconds. | |
| #define | NSECS(t) |
| Number of nanoseconds. | |
| #define | SEC(t) |
| Number of seconds. | |
| #define | SECOND(t) |
| Number of seconds. | |
| #define | SECONDS(t) |
| Number of seconds. | |
| #define | SECS(t) |
| Number of seconds. | |
| #define | USEC(t) |
| Number of microseconds. | |
| #define | USECS(t) |
| Number of microseconds. | |
| #define | WEEK(t) |
| Number of weeks. | |
| #define | WEEKS(t) |
| Number of weeks. | |
| #define | ZERO_TAG (tag_t){.time = 0LL, .microstep = 0u} |
| Zero tag. | |
Typedefs | |
| typedef int64_t | instant_t |
| Time instant. | |
| typedef int64_t | interval_t |
| Interval of time. | |
| typedef uint32_t | microstep_t |
| Microstep. | |
Functions | |
| size_t | lf_comma_separated_time (char *buffer, instant_t time) |
| Print a non-negative time value in nanoseconds with commas separating thousands into the specified buffer. | |
| tag_t | lf_delay_strict (tag_t tag, interval_t interval) |
| Return the latest tag strictly less than the specified tag plus the interval, unless tag is NEVER or interval is negative (including NEVER),. | |
| tag_t | lf_delay_tag (tag_t tag, interval_t interval) |
| Delay a tag by the specified time interval to realize the "after" keyword. | |
| size_t | lf_readable_time (char *buffer, instant_t time) |
| Store into the specified buffer a string giving a human-readable rendition of the specified time. | |
| tag_t | lf_tag (void *env) |
| Return the current tag, a logical time, microstep pair. | |
| tag_t | lf_tag_add (tag_t a, tag_t b) |
| Add two tags. | |
| int | lf_tag_compare (tag_t tag1, tag_t tag2) |
| Compare two tags. | |
| tag_t | lf_tag_latest_earlier (tag_t tag) |
| Return the greatest tag earlier than the given tag. | |
| tag_t | lf_tag_max (tag_t tag1, tag_t tag2) |
| Return the greater out of two tags. | |
| tag_t | lf_tag_min (tag_t tag1, tag_t tag2) |
| Return the lesser out of two tags. | |
| instant_t | lf_time_add (instant_t a, interval_t b) |
| Return the sum of an interval and an instant, saturating on overflow and underflow. | |
| instant_t | lf_time_logical (void *env) |
| Return the current logical time in nanoseconds. | |
| interval_t | lf_time_logical_elapsed (void *env) |
| Return the elapsed logical time in nanoseconds since the start of execution. | |
| instant_t | lf_time_physical (void) |
| Return the current physical time in nanoseconds. | |
| instant_t | lf_time_physical_elapsed (void) |
| Return the elapsed physical time in nanoseconds. | |
| instant_t | lf_time_start (void) |
| Return the physical and logical time of the start of execution in nanoseconds. | |
| instant_t | lf_time_subtract (instant_t a, interval_t b) |
| Return an instant minus an interval, saturating on overflow and underflow. | |
Time and tag definitions and functions for Lingua Franca.
This file defines the core time and tag types and operations used throughout the Lingua Franca runtime. It provides functions for manipulating logical and physical time, as well as the tag structure that combines time with microsteps.