|
Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
|
epoch_time API More...
Data Structures | |
| struct | epoch_time_cb |
| epoch time event callback structure. More... | |
Macros | |
| #define | SECONDS_PER_MINUTE (60) |
| Number of seconds in a minute. | |
| #define | SECONDS_PER_HOUR (60 * SECONDS_PER_MINUTE) |
| Number of seconds in an hour. | |
| #define | SECONDS_PER_DAY (24 * SECONDS_PER_HOUR) |
| Number of seconds in a day. | |
| #define | SECONDS_PER_WEEK (7 * SECONDS_PER_DAY) |
| Number of seconds in a week. | |
| #define | INFUSE_EPOCH_TIME_GPS_UNIX_OFFSET_SECONDS_LEAP 18 |
| Current offset between GPS and UNIX timestamps. | |
| #define | INFUSE_EPOCH_TIME_GPS_UNIX_OFFSET_SECONDS_BASE 315964800 |
| Unix time at the instant of the GPS epoch. | |
| #define | INFUSE_EPOCH_TIME_TICKS_PER_SEC (UINT16_MAX + 1) |
| Base tick rate of Infuse-IoT epoch time. | |
| #define | k_sec_to_epoch_floor32(t) |
| Convert seconds to epoch ticks. | |
| #define | k_sec_to_epoch_floor64(t) |
| Convert seconds to epoch ticks. | |
| #define | k_sec_to_epoch_near32(t) |
| Convert seconds to epoch ticks. | |
| #define | k_sec_to_epoch_near64(t) |
| Convert seconds to epoch ticks. | |
| #define | k_sec_to_epoch_ceil32(t) |
| Convert seconds to epoch ticks. | |
| #define | k_sec_to_epoch_ceil64(t) |
| Convert seconds to epoch ticks. | |
| #define | k_ms_to_epoch_floor32(t) |
| Convert milliseconds to epoch ticks. | |
| #define | k_ms_to_epoch_floor64(t) |
| Convert milliseconds to epoch ticks. | |
| #define | k_ms_to_epoch_near32(t) |
| Convert milliseconds to epoch ticks. | |
| #define | k_ms_to_epoch_near64(t) |
| Convert milliseconds to epoch ticks. | |
| #define | k_ms_to_epoch_ceil32(t) |
| Convert milliseconds to epoch ticks. | |
| #define | k_ms_to_epoch_ceil64(t) |
| Convert milliseconds to epoch ticks. | |
| #define | k_us_to_epoch_floor32(t) |
| Convert microseconds to epoch ticks. | |
| #define | k_us_to_epoch_floor64(t) |
| Convert microseconds to epoch ticks. | |
| #define | k_us_to_epoch_near32(t) |
| Convert microseconds to epoch ticks. | |
| #define | k_us_to_epoch_near64(t) |
| Convert microseconds to epoch ticks. | |
| #define | k_us_to_epoch_ceil32(t) |
| Convert microseconds to epoch ticks. | |
| #define | k_us_to_epoch_ceil64(t) |
| Convert microseconds to epoch ticks. | |
| #define | k_ns_to_epoch_floor32(t) |
| Convert nanoseconds to epoch ticks. | |
| #define | k_ns_to_epoch_floor64(t) |
| Convert nanoseconds to epoch ticks. | |
| #define | k_ns_to_epoch_near32(t) |
| Convert nanoseconds to epoch ticks. | |
| #define | k_ns_to_epoch_near64(t) |
| Convert nanoseconds to epoch ticks. | |
| #define | k_ns_to_epoch_ceil32(t) |
| Convert nanoseconds to epoch ticks. | |
| #define | k_ns_to_epoch_ceil64(t) |
| Convert nanoseconds to epoch ticks. | |
| #define | k_ticks_to_epoch_floor32(t) |
| Convert ticks to epoch ticks. | |
| #define | k_ticks_to_epoch_floor64(t) |
| Convert ticks to epoch ticks. | |
| #define | k_ticks_to_epoch_near32(t) |
| Convert ticks to epoch ticks. | |
| #define | k_ticks_to_epoch_near64(t) |
| Convert ticks to epoch ticks. | |
| #define | k_ticks_to_epoch_ceil32(t) |
| Convert ticks to epoch ticks. | |
| #define | k_ticks_to_epoch_ceil64(t) |
| Convert ticks to epoch ticks. | |
| #define | k_epoch_to_sec_floor32(t) |
| Convert epoch ticks to seconds. | |
| #define | k_epoch_to_sec_floor64(t) |
| Convert epoch ticks to seconds. | |
| #define | k_epoch_to_sec_near32(t) |
| Convert epoch ticks to seconds. | |
| #define | k_epoch_to_sec_near64(t) |
| Convert epoch ticks to seconds. | |
| #define | k_epoch_to_sec_ceil32(t) |
| Convert epoch ticks to seconds. | |
| #define | k_epoch_to_sec_ceil64(t) |
| Convert epoch ticks to seconds. | |
| #define | k_epoch_to_ms_floor32(t) |
| Convert epoch ticks to milliseconds. | |
| #define | k_epoch_to_ms_floor64(t) |
| Convert epoch ticks to milliseconds. | |
| #define | k_epoch_to_ms_near32(t) |
| Convert epoch ticks to milliseconds. | |
| #define | k_epoch_to_ms_near64(t) |
| Convert epoch ticks to milliseconds. | |
| #define | k_epoch_to_ms_ceil32(t) |
| Convert epoch ticks to milliseconds. | |
| #define | k_epoch_to_ms_ceil64(t) |
| Convert epoch ticks to milliseconds. | |
| #define | k_epoch_to_us_floor32(t) |
| Convert epoch ticks to microseconds. | |
| #define | k_epoch_to_us_floor64(t) |
| Convert epoch ticks to microseconds. | |
| #define | k_epoch_to_us_near32(t) |
| Convert epoch ticks to microseconds. | |
| #define | k_epoch_to_us_near64(t) |
| Convert epoch ticks to microseconds. | |
| #define | k_epoch_to_us_ceil32(t) |
| Convert epoch ticks to microseconds. | |
| #define | k_epoch_to_us_ceil64(t) |
| Convert epoch ticks to microseconds. | |
| #define | k_epoch_to_ns_floor32(t) |
| Convert epoch ticks to nanoseconds. | |
| #define | k_epoch_to_ns_floor64(t) |
| Convert epoch ticks to nanoseconds. | |
| #define | k_epoch_to_ns_near32(t) |
| Convert epoch ticks to nanoseconds. | |
| #define | k_epoch_to_ns_near64(t) |
| Convert epoch ticks to nanoseconds. | |
| #define | k_epoch_to_ns_ceil32(t) |
| Convert epoch ticks to nanoseconds. | |
| #define | k_epoch_to_ns_ceil64(t) |
| Convert epoch ticks to nanoseconds. | |
| #define | k_epoch_to_ticks_floor32(t) |
| Convert epoch ticks to ticks. | |
| #define | k_epoch_to_ticks_floor64(t) |
| Convert epoch ticks to ticks. | |
| #define | k_epoch_to_ticks_near32(t) |
| Convert epoch ticks to ticks. | |
| #define | k_epoch_to_ticks_near64(t) |
| Convert epoch ticks to ticks. | |
| #define | k_epoch_to_ticks_ceil32(t) |
| Convert epoch ticks to ticks. | |
| #define | k_epoch_to_ticks_ceil64(t) |
| Convert epoch ticks to ticks. | |
Enumerations | |
| enum | epoch_time_source { TIME_SOURCE_NONE = 0 , TIME_SOURCE_GNSS , TIME_SOURCE_NTP , TIME_SOURCE_RPC , TIME_SOURCE_EPACKET , TIME_SOURCE_INVALID , TIME_SOURCE_RECOVERED = 0x80 } |
| Source of time knowledge. More... | |
Functions | |
| void | epoch_time_register_callback (struct epoch_time_cb *cb) |
| Register to be notified of epoch time events. | |
| static enum epoch_time_source | epoch_time_source_base (enum epoch_time_source source) |
| Extract the base time source (no flags) from a time source. | |
| static bool | epoch_time_trusted_source (enum epoch_time_source source, bool recovered_ok) |
| Determine whether a given time source should be trusted. | |
| static bool | epoch_time_precise_source (enum epoch_time_source source) |
| Determine whether a given time source is considered 'precise'. | |
| static uint64_t | epoch_time_seconds (uint64_t epoch_time) |
| Extracts epoch seconds from a complete epoch time. | |
| static uint16_t | epoch_time_subseconds (uint64_t epoch_time) |
| Extracts epoch subseconds from a complete epoch time. | |
| static uint16_t | epoch_time_milliseconds (uint64_t epoch_time) |
| Extracts epoch milliseconds from a complete epoch time. | |
| static uint64_t | epoch_time_from (uint64_t seconds, uint16_t subseconds) |
| Convert seconds and subseconds to complete epoch time. | |
| static uint64_t | epoch_time_from_gps (uint16_t week, uint32_t week_seconds, uint16_t subseconds) |
| Convert GPS time format to complete epoch time. | |
| static uint32_t | unix_time_from_epoch (uint64_t epoch_time) |
| Convert epoch time to current unix time. | |
| static uint64_t | epoch_time_from_unix (uint32_t unix_time, uint16_t subseconds) |
| Convert unix time to current epoch time. | |
| uint64_t | ticks_from_epoch_time (uint64_t epoch_time) |
| Get a tick count associated with a epoch time. | |
| uint64_t | epoch_time_from_ticks (uint64_t ticks) |
| Get the epoch time associated with a local uptime. | |
| uint32_t | epoch_period_from_array_ticks (uint64_t array_ticks, uint16_t array_num) |
| Get the epoch time period associated with an array. | |
| uint64_t | epoch_time_now (void) |
| Get the current epoch time. | |
| void | epoch_time_unix_calendar (uint64_t epoch_time, struct tm *calendar) |
| Convert a epoch time to a unix time calendar. | |
| enum epoch_time_source | epoch_time_get_source (void) |
| Get the current source of epoch time knowledge. | |
| int | epoch_time_set_reference (enum epoch_time_source source, struct timeutil_sync_instant *reference) |
| Set the local to epoch time reference instant. | |
| uint32_t | epoch_time_reference_age (void) |
| Query how many seconds ago the reference instant was set. | |
| int | epoch_time_reference_shift (const struct timeutil_sync_instant *ref_a, const struct timeutil_sync_instant *ref_b, int64_t *epoch_shift) |
| Determine the epoch time shift due to moving from ref_a to ref_b. | |
epoch_time API
| #define INFUSE_EPOCH_TIME_GPS_UNIX_OFFSET_SECONDS_BASE 315964800 |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Unix time at the instant of the GPS epoch.
| #define INFUSE_EPOCH_TIME_GPS_UNIX_OFFSET_SECONDS_LEAP 18 |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Current offset between GPS and UNIX timestamps.
| #define INFUSE_EPOCH_TIME_TICKS_PER_SEC (UINT16_MAX + 1) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Base tick rate of Infuse-IoT epoch time.
| #define k_epoch_to_ms_ceil32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to milliseconds.
32 bits. Rounds up.
Converts time values in epoch ticks to milliseconds. Computes result in 32 bit precision. Rounds up to the next highest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_ms_ceil64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to milliseconds.
64 bits. Rounds up.
Converts time values in epoch ticks to milliseconds. Computes result in 64 bit precision. Rounds up to the next highest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_ms_floor32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to milliseconds.
32 bits. Truncates.
Converts time values in epoch ticks to milliseconds. Computes result in 32 bit precision. Truncates to the next lowest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_ms_floor64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to milliseconds.
64 bits. Truncates.
Converts time values in epoch ticks to milliseconds. Computes result in 64 bit precision. Truncates to the next lowest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_ms_near32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to milliseconds.
32 bits. Round nearest.
Converts time values in epoch ticks to milliseconds. Computes result in 32 bit precision. Rounds to the nearest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_ms_near64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to milliseconds.
64 bits. Round nearest.
Converts time values in epoch ticks to milliseconds. Computes result in 64 bit precision. Rounds to the nearest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_ns_ceil32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to nanoseconds.
32 bits. Rounds up.
Converts time values in epoch ticks to nanoseconds. Computes result in 32 bit precision. Rounds up to the next highest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_ns_ceil64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to nanoseconds.
64 bits. Rounds up.
Converts time values in epoch ticks to nanoseconds. Computes result in 64 bit precision. Rounds up to the next highest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_ns_floor32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to nanoseconds.
32 bits. Truncates.
Converts time values in epoch ticks to nanoseconds. Computes result in 32 bit precision. Truncates to the next lowest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_ns_floor64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to nanoseconds.
64 bits. Truncates.
Converts time values in epoch ticks to nanoseconds. Computes result in 64 bit precision. Truncates to the next lowest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_ns_near32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to nanoseconds.
32 bits. Round nearest.
Converts time values in epoch ticks to nanoseconds. Computes result in 32 bit precision. Rounds to the nearest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_ns_near64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to nanoseconds.
64 bits. Round nearest.
Converts time values in epoch ticks to nanoseconds. Computes result in 64 bit precision. Rounds to the nearest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_sec_ceil32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to seconds.
32 bits. Rounds up.
Converts time values in epoch ticks to seconds. Computes result in 32 bit precision. Rounds up to the next highest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_sec_ceil64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to seconds.
64 bits. Rounds up.
Converts time values in epoch ticks to seconds. Computes result in 64 bit precision. Rounds up to the next highest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_sec_floor32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to seconds.
32 bits. Truncates.
Converts time values in epoch ticks to seconds. Computes result in 32 bit precision. Truncates to the next lowest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_sec_floor64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to seconds.
64 bits. Truncates.
Converts time values in epoch ticks to seconds. Computes result in 64 bit precision. Truncates to the next lowest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_sec_near32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to seconds.
32 bits. Round nearest.
Converts time values in epoch ticks to seconds. Computes result in 32 bit precision. Rounds to the nearest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_sec_near64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to seconds.
64 bits. Round nearest.
Converts time values in epoch ticks to seconds. Computes result in 64 bit precision. Rounds to the nearest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_ticks_ceil32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to ticks.
32 bits. Rounds up.
Converts time values in epoch ticks to ticks. Computes result in 32 bit precision. Rounds up to the next highest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_ticks_ceil64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to ticks.
64 bits. Rounds up.
Converts time values in epoch ticks to ticks. Computes result in 64 bit precision. Rounds up to the next highest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_ticks_floor32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to ticks.
32 bits. Truncates.
Converts time values in epoch ticks to ticks. Computes result in 32 bit precision. Truncates to the next lowest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_ticks_floor64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to ticks.
64 bits. Truncates.
Converts time values in epoch ticks to ticks. Computes result in 64 bit precision. Truncates to the next lowest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_ticks_near32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to ticks.
32 bits. Round nearest.
Converts time values in epoch ticks to ticks. Computes result in 32 bit precision. Rounds to the nearest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_ticks_near64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to ticks.
64 bits. Round nearest.
Converts time values in epoch ticks to ticks. Computes result in 64 bit precision. Rounds to the nearest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_us_ceil32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to microseconds.
32 bits. Rounds up.
Converts time values in epoch ticks to microseconds. Computes result in 32 bit precision. Rounds up to the next highest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_us_ceil64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to microseconds.
64 bits. Rounds up.
Converts time values in epoch ticks to microseconds. Computes result in 64 bit precision. Rounds up to the next highest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_us_floor32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to microseconds.
32 bits. Truncates.
Converts time values in epoch ticks to microseconds. Computes result in 32 bit precision. Truncates to the next lowest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_us_floor64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to microseconds.
64 bits. Truncates.
Converts time values in epoch ticks to microseconds. Computes result in 64 bit precision. Truncates to the next lowest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_us_near32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to microseconds.
32 bits. Round nearest.
Converts time values in epoch ticks to microseconds. Computes result in 32 bit precision. Rounds to the nearest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_epoch_to_us_near64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert epoch ticks to microseconds.
64 bits. Round nearest.
Converts time values in epoch ticks to microseconds. Computes result in 64 bit precision. Rounds to the nearest output unit.
| t | Source time in epoch ticks. uint64_t |
| #define k_ms_to_epoch_ceil32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert milliseconds to epoch ticks.
32 bits. Rounds up.
Converts time values in milliseconds to epoch ticks. Computes result in 32 bit precision. Rounds up to the next highest output unit.
| t | Source time in milliseconds. uint64_t |
| #define k_ms_to_epoch_ceil64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert milliseconds to epoch ticks.
64 bits. Rounds up.
Converts time values in milliseconds to epoch ticks. Computes result in 64 bit precision. Rounds up to the next highest output unit.
| t | Source time in milliseconds. uint64_t |
| #define k_ms_to_epoch_floor32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert milliseconds to epoch ticks.
32 bits. Truncates.
Converts time values in milliseconds to epoch ticks. Computes result in 32 bit precision. Truncates to the next lowest output unit.
| t | Source time in milliseconds. uint64_t |
| #define k_ms_to_epoch_floor64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert milliseconds to epoch ticks.
64 bits. Truncates.
Converts time values in milliseconds to epoch ticks. Computes result in 64 bit precision. Truncates to the next lowest output unit.
| t | Source time in milliseconds. uint64_t |
| #define k_ms_to_epoch_near32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert milliseconds to epoch ticks.
32 bits. Round nearest.
Converts time values in milliseconds to epoch ticks. Computes result in 32 bit precision. Rounds to the nearest output unit.
| t | Source time in milliseconds. uint64_t |
| #define k_ms_to_epoch_near64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert milliseconds to epoch ticks.
64 bits. Round nearest.
Converts time values in milliseconds to epoch ticks. Computes result in 64 bit precision. Rounds to the nearest output unit.
| t | Source time in milliseconds. uint64_t |
| #define k_ns_to_epoch_ceil32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert nanoseconds to epoch ticks.
32 bits. Rounds up.
Converts time values in nanoseconds to epoch ticks. Computes result in 32 bit precision. Rounds up to the next highest output unit.
| t | Source time in nanoseconds. uint64_t |
| #define k_ns_to_epoch_ceil64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert nanoseconds to epoch ticks.
64 bits. Rounds up.
Converts time values in nanoseconds to epoch ticks. Computes result in 64 bit precision. Rounds up to the next highest output unit.
| t | Source time in nanoseconds. uint64_t |
| #define k_ns_to_epoch_floor32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert nanoseconds to epoch ticks.
32 bits. Truncates.
Converts time values in nanoseconds to epoch ticks. Computes result in 32 bit precision. Truncates to the next lowest output unit.
| t | Source time in nanoseconds. uint64_t |
| #define k_ns_to_epoch_floor64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert nanoseconds to epoch ticks.
64 bits. Truncates.
Converts time values in nanoseconds to epoch ticks. Computes result in 64 bit precision. Truncates to the next lowest output unit.
| t | Source time in nanoseconds. uint64_t |
| #define k_ns_to_epoch_near32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert nanoseconds to epoch ticks.
32 bits. Round nearest.
Converts time values in nanoseconds to epoch ticks. Computes result in 32 bit precision. Rounds to the nearest output unit.
| t | Source time in nanoseconds. uint64_t |
| #define k_ns_to_epoch_near64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert nanoseconds to epoch ticks.
64 bits. Round nearest.
Converts time values in nanoseconds to epoch ticks. Computes result in 64 bit precision. Rounds to the nearest output unit.
| t | Source time in nanoseconds. uint64_t |
| #define k_sec_to_epoch_ceil32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert seconds to epoch ticks.
32 bits. Rounds up.
Converts time values in seconds to epoch ticks. Computes result in 32 bit precision. Rounds up to the next highest output unit.
| t | Source time in seconds. uint64_t |
| #define k_sec_to_epoch_ceil64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert seconds to epoch ticks.
64 bits. Rounds up.
Converts time values in seconds to epoch ticks. Computes result in 64 bit precision. Rounds up to the next highest output unit.
| t | Source time in seconds. uint64_t |
| #define k_sec_to_epoch_floor32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert seconds to epoch ticks.
32 bits. Truncates.
Converts time values in seconds to epoch ticks. Computes result in 32 bit precision. Truncates to the next lowest output unit.
| t | Source time in seconds. uint64_t |
| #define k_sec_to_epoch_floor64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert seconds to epoch ticks.
64 bits. Truncates.
Converts time values in seconds to epoch ticks. Computes result in 64 bit precision. Truncates to the next lowest output unit.
| t | Source time in seconds. uint64_t |
| #define k_sec_to_epoch_near32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert seconds to epoch ticks.
32 bits. Round nearest.
Converts time values in seconds to epoch ticks. Computes result in 32 bit precision. Rounds to the nearest output unit.
| t | Source time in seconds. uint64_t |
| #define k_sec_to_epoch_near64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert seconds to epoch ticks.
64 bits. Round nearest.
Converts time values in seconds to epoch ticks. Computes result in 64 bit precision. Rounds to the nearest output unit.
| t | Source time in seconds. uint64_t |
| #define k_ticks_to_epoch_ceil32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert ticks to epoch ticks.
32 bits. Rounds up.
Converts time values in ticks to epoch ticks. Computes result in 32 bit precision. Rounds up to the next highest output unit.
| t | Source time in ticks. uint64_t |
| #define k_ticks_to_epoch_ceil64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert ticks to epoch ticks.
64 bits. Rounds up.
Converts time values in ticks to epoch ticks. Computes result in 64 bit precision. Rounds up to the next highest output unit.
| t | Source time in ticks. uint64_t |
| #define k_ticks_to_epoch_floor32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert ticks to epoch ticks.
32 bits. Truncates.
Converts time values in ticks to epoch ticks. Computes result in 32 bit precision. Truncates to the next lowest output unit.
| t | Source time in ticks. uint64_t |
| #define k_ticks_to_epoch_floor64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert ticks to epoch ticks.
64 bits. Truncates.
Converts time values in ticks to epoch ticks. Computes result in 64 bit precision. Truncates to the next lowest output unit.
| t | Source time in ticks. uint64_t |
| #define k_ticks_to_epoch_near32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert ticks to epoch ticks.
32 bits. Round nearest.
Converts time values in ticks to epoch ticks. Computes result in 32 bit precision. Rounds to the nearest output unit.
| t | Source time in ticks. uint64_t |
| #define k_ticks_to_epoch_near64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert ticks to epoch ticks.
64 bits. Round nearest.
Converts time values in ticks to epoch ticks. Computes result in 64 bit precision. Rounds to the nearest output unit.
| t | Source time in ticks. uint64_t |
| #define k_us_to_epoch_ceil32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert microseconds to epoch ticks.
32 bits. Rounds up.
Converts time values in microseconds to epoch ticks. Computes result in 32 bit precision. Rounds up to the next highest output unit.
| t | Source time in microseconds. uint64_t |
| #define k_us_to_epoch_ceil64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert microseconds to epoch ticks.
64 bits. Rounds up.
Converts time values in microseconds to epoch ticks. Computes result in 64 bit precision. Rounds up to the next highest output unit.
| t | Source time in microseconds. uint64_t |
| #define k_us_to_epoch_floor32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert microseconds to epoch ticks.
32 bits. Truncates.
Converts time values in microseconds to epoch ticks. Computes result in 32 bit precision. Truncates to the next lowest output unit.
| t | Source time in microseconds. uint64_t |
| #define k_us_to_epoch_floor64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert microseconds to epoch ticks.
64 bits. Truncates.
Converts time values in microseconds to epoch ticks. Computes result in 64 bit precision. Truncates to the next lowest output unit.
| t | Source time in microseconds. uint64_t |
| #define k_us_to_epoch_near32 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert microseconds to epoch ticks.
32 bits. Round nearest.
Converts time values in microseconds to epoch ticks. Computes result in 32 bit precision. Rounds to the nearest output unit.
| t | Source time in microseconds. uint64_t |
| #define k_us_to_epoch_near64 | ( | t | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>
Convert microseconds to epoch ticks.
64 bits. Round nearest.
Converts time values in microseconds to epoch ticks. Computes result in 64 bit precision. Rounds to the nearest output unit.
| t | Source time in microseconds. uint64_t |
| #define SECONDS_PER_DAY (24 * SECONDS_PER_HOUR) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Number of seconds in a day.
| #define SECONDS_PER_HOUR (60 * SECONDS_PER_MINUTE) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Number of seconds in an hour.
| #define SECONDS_PER_MINUTE (60) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Number of seconds in a minute.
| #define SECONDS_PER_WEEK (7 * SECONDS_PER_DAY) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Number of seconds in a week.
| enum epoch_time_source |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Source of time knowledge.
| uint32_t epoch_period_from_array_ticks | ( | uint64_t | array_ticks, |
| uint16_t | array_num ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Get the epoch time period associated with an array.
| array_ticks | Ticks between first and last sample in array |
| array_num | Number of samples in array |
|
inlinestatic |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Convert seconds and subseconds to complete epoch time.
| seconds | Number of seconds since GPS epoch |
| subseconds | Fractional component of time since GPS epoch |
| epoch_time | Complete epoch time |
|
inlinestatic |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Convert GPS time format to complete epoch time.
| week | GPS week counter |
| week_seconds | GPS seconds of week |
| subseconds | Fractional component of time since GPS epoch |
| epoch_time | Complete epoch time |
| uint64_t epoch_time_from_ticks | ( | uint64_t | ticks | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Get the epoch time associated with a local uptime.
| ticks | Kernel tick count |
|
inlinestatic |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Convert unix time to current epoch time.
| unix_time | Current unix time |
| subseconds | Fractional component of unix time |
| epoch_time | Complete epoch time |
| enum epoch_time_source epoch_time_get_source | ( | void | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Get the current source of epoch time knowledge.
|
inlinestatic |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Extracts epoch milliseconds from a complete epoch time.
| epoch_time | Complete epoch time |
| milliseconds | Fractional component of time since GPS epoch |
| uint64_t epoch_time_now | ( | void | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Get the current epoch time.
| epoch_time | Complete epoch time |
|
inlinestatic |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Determine whether a given time source is considered 'precise'.
Precise in this context means the accuracy of the time knowledge can be reasonably assumed to be within a few milliseconds.
| source | Time source |
| uint32_t epoch_time_reference_age | ( | void | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Query how many seconds ago the reference instant was set.
| UINT32_MAX | if not yet set |
| seconds | since reference instant was set |
| int epoch_time_reference_shift | ( | const struct timeutil_sync_instant * | ref_a, |
| const struct timeutil_sync_instant * | ref_b, | ||
| int64_t * | epoch_shift ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Determine the epoch time shift due to moving from ref_a to ref_b.
| ref_a | Original reference point |
| ref_b | Updated reference point |
| epoch_shift | Time shift from updating reference points |
| 0 | On success |
| -EINVAL | If either sync instant is invalid |
| void epoch_time_register_callback | ( | struct epoch_time_cb * | cb | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Register to be notified of epoch time events.
| cb | Callback struct to register |
|
inlinestatic |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Extracts epoch seconds from a complete epoch time.
| epoch_time | Complete epoch time |
| seconds | Number of seconds since GPS epoch |
| int epoch_time_set_reference | ( | enum epoch_time_source | source, |
| struct timeutil_sync_instant * | reference ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Set the local to epoch time reference instant.
| source | Source of the reference instant |
| reference | Same instant in local and epoch time bases |
| 0 | on success |
| -EINVAL | if reference instant is invalid |
|
inlinestatic |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Extract the base time source (no flags) from a time source.
| source | Time source from epoch_time_get_source |
|
inlinestatic |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Extracts epoch subseconds from a complete epoch time.
| epoch_time | Complete epoch time |
| subseconds | Fractional component of time since GPS epoch |
|
inlinestatic |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Determine whether a given time source should be trusted.
| source | Time source |
| recovered_ok | Should a time source recovered across a reboot be trusted |
| void epoch_time_unix_calendar | ( | uint64_t | epoch_time, |
| struct tm * | calendar ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Convert a epoch time to a unix time calendar.
| epoch_time | Complete epoch time |
| calendar | Output calendar |
| uint64_t ticks_from_epoch_time | ( | uint64_t | epoch_time | ) |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Get a tick count associated with a epoch time.
| epoch_time | epoch time |
|
inlinestatic |
#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>
Convert epoch time to current unix time.
| epoch_time | Complete epoch time |
| unix_time | Current unix time |