Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Epoch APIs

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.

Detailed Description

epoch_time API

Macro Definition Documentation

◆ INFUSE_EPOCH_TIME_GPS_UNIX_OFFSET_SECONDS_BASE

#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.

◆ INFUSE_EPOCH_TIME_GPS_UNIX_OFFSET_SECONDS_LEAP

#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.

Warning
This value will be incorrect after the next leap-second

◆ INFUSE_EPOCH_TIME_TICKS_PER_SEC

#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.

◆ k_epoch_to_ms_ceil32

#define k_epoch_to_ms_ceil32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_epoch, Z_HZ_ms, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in milliseconds. uint32_t

◆ k_epoch_to_ms_ceil64

#define k_epoch_to_ms_ceil64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_epoch, Z_HZ_ms, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in milliseconds. uint64_t

◆ k_epoch_to_ms_floor32

#define k_epoch_to_ms_floor32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_epoch, Z_HZ_ms, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in milliseconds. uint32_t

◆ k_epoch_to_ms_floor64

#define k_epoch_to_ms_floor64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_epoch, Z_HZ_ms, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in milliseconds. uint64_t

◆ k_epoch_to_ms_near32

#define k_epoch_to_ms_near32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_epoch, Z_HZ_ms, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in milliseconds. uint32_t

◆ k_epoch_to_ms_near64

#define k_epoch_to_ms_near64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_epoch, Z_HZ_ms, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in milliseconds. uint64_t

◆ k_epoch_to_ns_ceil32

#define k_epoch_to_ns_ceil32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_epoch, Z_HZ_ns, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in nanoseconds. uint32_t

◆ k_epoch_to_ns_ceil64

#define k_epoch_to_ns_ceil64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_epoch, Z_HZ_ns, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in nanoseconds. uint64_t

◆ k_epoch_to_ns_floor32

#define k_epoch_to_ns_floor32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_epoch, Z_HZ_ns, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in nanoseconds. uint32_t

◆ k_epoch_to_ns_floor64

#define k_epoch_to_ns_floor64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_epoch, Z_HZ_ns, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in nanoseconds. uint64_t

◆ k_epoch_to_ns_near32

#define k_epoch_to_ns_near32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_epoch, Z_HZ_ns, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in nanoseconds. uint32_t

◆ k_epoch_to_ns_near64

#define k_epoch_to_ns_near64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_epoch, Z_HZ_ns, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in nanoseconds. uint64_t

◆ k_epoch_to_sec_ceil32

#define k_epoch_to_sec_ceil32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_epoch, Z_HZ_sec, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in seconds. uint32_t

◆ k_epoch_to_sec_ceil64

#define k_epoch_to_sec_ceil64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_epoch, Z_HZ_sec, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in seconds. uint64_t

◆ k_epoch_to_sec_floor32

#define k_epoch_to_sec_floor32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_epoch, Z_HZ_sec, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in seconds. uint32_t

◆ k_epoch_to_sec_floor64

#define k_epoch_to_sec_floor64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_epoch, Z_HZ_sec, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in seconds. uint64_t

◆ k_epoch_to_sec_near32

#define k_epoch_to_sec_near32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_epoch, Z_HZ_sec, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in seconds. uint32_t

◆ k_epoch_to_sec_near64

#define k_epoch_to_sec_near64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_epoch, Z_HZ_sec, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in seconds. uint64_t

◆ k_epoch_to_ticks_ceil32

#define k_epoch_to_ticks_ceil32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_epoch, Z_HZ_ticks, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in ticks. uint32_t

◆ k_epoch_to_ticks_ceil64

#define k_epoch_to_ticks_ceil64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_epoch, Z_HZ_ticks, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in ticks. uint64_t

◆ k_epoch_to_ticks_floor32

#define k_epoch_to_ticks_floor32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_epoch, Z_HZ_ticks, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in ticks. uint32_t

◆ k_epoch_to_ticks_floor64

#define k_epoch_to_ticks_floor64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_epoch, Z_HZ_ticks, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in ticks. uint64_t

◆ k_epoch_to_ticks_near32

#define k_epoch_to_ticks_near32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_epoch, Z_HZ_ticks, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in ticks. uint32_t

◆ k_epoch_to_ticks_near64

#define k_epoch_to_ticks_near64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_epoch, Z_HZ_ticks, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in ticks. uint64_t

◆ k_epoch_to_us_ceil32

#define k_epoch_to_us_ceil32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_epoch, Z_HZ_us, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in microseconds. uint32_t

◆ k_epoch_to_us_ceil64

#define k_epoch_to_us_ceil64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_epoch, Z_HZ_us, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in microseconds. uint64_t

◆ k_epoch_to_us_floor32

#define k_epoch_to_us_floor32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_epoch, Z_HZ_us, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in microseconds. uint32_t

◆ k_epoch_to_us_floor64

#define k_epoch_to_us_floor64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_epoch, Z_HZ_us, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in microseconds. uint64_t

◆ k_epoch_to_us_near32

#define k_epoch_to_us_near32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_epoch, Z_HZ_us, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in microseconds. uint32_t

◆ k_epoch_to_us_near64

#define k_epoch_to_us_near64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_epoch, Z_HZ_us, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in epoch ticks. uint64_t
Returns
The converted time value in microseconds. uint64_t

◆ k_ms_to_epoch_ceil32

#define k_ms_to_epoch_ceil32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_ms, Z_HZ_epoch, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in milliseconds. uint64_t
Returns
The converted time value in epoch ticks. uint32_t

◆ k_ms_to_epoch_ceil64

#define k_ms_to_epoch_ceil64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_ms, Z_HZ_epoch, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in milliseconds. uint64_t
Returns
The converted time value in epoch ticks. uint64_t

◆ k_ms_to_epoch_floor32

#define k_ms_to_epoch_floor32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_ms, Z_HZ_epoch, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in milliseconds. uint64_t
Returns
The converted time value in epoch ticks. uint32_t

◆ k_ms_to_epoch_floor64

#define k_ms_to_epoch_floor64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_ms, Z_HZ_epoch, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in milliseconds. uint64_t
Returns
The converted time value in epoch ticks. uint64_t

◆ k_ms_to_epoch_near32

#define k_ms_to_epoch_near32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_ms, Z_HZ_epoch, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in milliseconds. uint64_t
Returns
The converted time value in epoch ticks. uint32_t

◆ k_ms_to_epoch_near64

#define k_ms_to_epoch_near64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_ms, Z_HZ_epoch, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in milliseconds. uint64_t
Returns
The converted time value in epoch ticks. uint64_t

◆ k_ns_to_epoch_ceil32

#define k_ns_to_epoch_ceil32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_ns, Z_HZ_epoch, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in nanoseconds. uint64_t
Returns
The converted time value in epoch ticks. uint32_t

◆ k_ns_to_epoch_ceil64

#define k_ns_to_epoch_ceil64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_ns, Z_HZ_epoch, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in nanoseconds. uint64_t
Returns
The converted time value in epoch ticks. uint64_t

◆ k_ns_to_epoch_floor32

#define k_ns_to_epoch_floor32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_ns, Z_HZ_epoch, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in nanoseconds. uint64_t
Returns
The converted time value in epoch ticks. uint32_t

◆ k_ns_to_epoch_floor64

#define k_ns_to_epoch_floor64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_ns, Z_HZ_epoch, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in nanoseconds. uint64_t
Returns
The converted time value in epoch ticks. uint64_t

◆ k_ns_to_epoch_near32

#define k_ns_to_epoch_near32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_ns, Z_HZ_epoch, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in nanoseconds. uint64_t
Returns
The converted time value in epoch ticks. uint32_t

◆ k_ns_to_epoch_near64

#define k_ns_to_epoch_near64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_ns, Z_HZ_epoch, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in nanoseconds. uint64_t
Returns
The converted time value in epoch ticks. uint64_t

◆ k_sec_to_epoch_ceil32

#define k_sec_to_epoch_ceil32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_sec, Z_HZ_epoch, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in seconds. uint64_t
Returns
The converted time value in epoch ticks. uint32_t

◆ k_sec_to_epoch_ceil64

#define k_sec_to_epoch_ceil64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_sec, Z_HZ_epoch, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in seconds. uint64_t
Returns
The converted time value in epoch ticks. uint64_t

◆ k_sec_to_epoch_floor32

#define k_sec_to_epoch_floor32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_sec, Z_HZ_epoch, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in seconds. uint64_t
Returns
The converted time value in epoch ticks. uint32_t

◆ k_sec_to_epoch_floor64

#define k_sec_to_epoch_floor64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_sec, Z_HZ_epoch, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in seconds. uint64_t
Returns
The converted time value in epoch ticks. uint64_t

◆ k_sec_to_epoch_near32

#define k_sec_to_epoch_near32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_sec, Z_HZ_epoch, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in seconds. uint64_t
Returns
The converted time value in epoch ticks. uint32_t

◆ k_sec_to_epoch_near64

#define k_sec_to_epoch_near64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_sec, Z_HZ_epoch, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in seconds. uint64_t
Returns
The converted time value in epoch ticks. uint64_t

◆ k_ticks_to_epoch_ceil32

#define k_ticks_to_epoch_ceil32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_epoch, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in epoch ticks. uint32_t

◆ k_ticks_to_epoch_ceil64

#define k_ticks_to_epoch_ceil64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_epoch, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in epoch ticks. uint64_t

◆ k_ticks_to_epoch_floor32

#define k_ticks_to_epoch_floor32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_epoch, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in epoch ticks. uint32_t

◆ k_ticks_to_epoch_floor64

#define k_ticks_to_epoch_floor64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_epoch, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in epoch ticks. uint64_t

◆ k_ticks_to_epoch_near32

#define k_ticks_to_epoch_near32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_epoch, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in epoch ticks. uint32_t

◆ k_ticks_to_epoch_near64

#define k_ticks_to_epoch_near64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_epoch, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in epoch ticks. uint64_t

◆ k_us_to_epoch_ceil32

#define k_us_to_epoch_ceil32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_us, Z_HZ_epoch, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in microseconds. uint64_t
Returns
The converted time value in epoch ticks. uint32_t

◆ k_us_to_epoch_ceil64

#define k_us_to_epoch_ceil64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_us, Z_HZ_epoch, true, true, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in microseconds. uint64_t
Returns
The converted time value in epoch ticks. uint64_t

◆ k_us_to_epoch_floor32

#define k_us_to_epoch_floor32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_us, Z_HZ_epoch, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in microseconds. uint64_t
Returns
The converted time value in epoch ticks. uint32_t

◆ k_us_to_epoch_floor64

#define k_us_to_epoch_floor64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_us, Z_HZ_epoch, true, false, false)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in microseconds. uint64_t
Returns
The converted time value in epoch ticks. uint64_t

◆ k_us_to_epoch_near32

#define k_us_to_epoch_near32 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_32(t, Z_HZ_us, Z_HZ_epoch, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in microseconds. uint64_t
Returns
The converted time value in epoch ticks. uint32_t

◆ k_us_to_epoch_near64

#define k_us_to_epoch_near64 ( t)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch_units.h>

Value:
z_tmcvt_64(t, Z_HZ_us, Z_HZ_epoch, true, false, true)

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.

Warning
Generated. Do not edit. See above.
Parameters
tSource time in microseconds. uint64_t
Returns
The converted time value in epoch ticks. uint64_t

◆ SECONDS_PER_DAY

#define SECONDS_PER_DAY   (24 * SECONDS_PER_HOUR)

◆ SECONDS_PER_HOUR

#define SECONDS_PER_HOUR   (60 * SECONDS_PER_MINUTE)

◆ SECONDS_PER_MINUTE

#define SECONDS_PER_MINUTE   (60)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>

Number of seconds in a minute.

◆ SECONDS_PER_WEEK

#define SECONDS_PER_WEEK   (7 * SECONDS_PER_DAY)

Enumeration Type Documentation

◆ epoch_time_source

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>

Source of time knowledge.

Enumerator
TIME_SOURCE_NONE 

No time knowledge.

TIME_SOURCE_GNSS 

Time from GNSS constellation (GPS, Beidou, etc)

TIME_SOURCE_NTP 

Time from Network Time Protocol (IP)

TIME_SOURCE_RPC 

Time directly set by Remote Procedure Call.

TIME_SOURCE_EPACKET 

Time from observed ePacket headers.

TIME_SOURCE_INVALID 

Unknown time source value.

TIME_SOURCE_RECOVERED 

Time has been preserved across a reboot.

Function Documentation

◆ epoch_period_from_array_ticks()

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.

Parameters
array_ticksTicks between first and last sample in array
array_numNumber of samples in array
Returns
uint32_t Equivalent period in epoch time units

◆ epoch_time_from()

uint64_t epoch_time_from ( uint64_t seconds,
uint16_t subseconds )
inlinestatic

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>

Convert seconds and subseconds to complete epoch time.

Parameters
secondsNumber of seconds since GPS epoch
subsecondsFractional component of time since GPS epoch
Return values
epoch_timeComplete epoch time

◆ epoch_time_from_gps()

uint64_t epoch_time_from_gps ( uint16_t week,
uint32_t week_seconds,
uint16_t subseconds )
inlinestatic

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>

Convert GPS time format to complete epoch time.

Parameters
weekGPS week counter
week_secondsGPS seconds of week
subsecondsFractional component of time since GPS epoch
Return values
epoch_timeComplete epoch time

◆ epoch_time_from_ticks()

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.

Parameters
ticksKernel tick count
Returns
uint64_t Equivalent time in epoch time

◆ epoch_time_from_unix()

uint64_t epoch_time_from_unix ( uint32_t unix_time,
uint16_t subseconds )
inlinestatic

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>

Convert unix time to current epoch time.

Warning
To simplify the implementation, this function is only guaranteed to be correct for times since the last leap second (31st December 2016) until the next leap second (unknown).
Parameters
unix_timeCurrent unix time
subsecondsFractional component of unix time
Return values
epoch_timeComplete epoch time

◆ epoch_time_get_source()

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.

Returns
enum epoch_time_source Current time source

◆ epoch_time_milliseconds()

uint16_t epoch_time_milliseconds ( uint64_t epoch_time)
inlinestatic

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>

Extracts epoch milliseconds from a complete epoch time.

Parameters
epoch_timeComplete epoch time
Return values
millisecondsFractional component of time since GPS epoch

◆ epoch_time_now()

uint64_t epoch_time_now ( void )

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>

Get the current epoch time.

Return values
epoch_timeComplete epoch time

◆ epoch_time_precise_source()

bool epoch_time_precise_source ( enum epoch_time_source source)
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.

Parameters
sourceTime source
Returns
true Time source is precise
false Time source is not precise

◆ epoch_time_reference_age()

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.

Return values
UINT32_MAXif not yet set
secondssince reference instant was set

◆ epoch_time_reference_shift()

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.

Parameters
ref_aOriginal reference point
ref_bUpdated reference point
epoch_shiftTime shift from updating reference points
Return values
0On success
-EINVALIf either sync instant is invalid

◆ epoch_time_register_callback()

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.

Parameters
cbCallback struct to register

◆ epoch_time_seconds()

uint64_t epoch_time_seconds ( uint64_t epoch_time)
inlinestatic

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>

Extracts epoch seconds from a complete epoch time.

Parameters
epoch_timeComplete epoch time
Return values
secondsNumber of seconds since GPS epoch

◆ epoch_time_set_reference()

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.

Parameters
sourceSource of the reference instant
referenceSame instant in local and epoch time bases
Return values
0on success
-EINVALif reference instant is invalid

◆ epoch_time_source_base()

enum epoch_time_source epoch_time_source_base ( enum epoch_time_source source)
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.

Parameters
sourceTime source from epoch_time_get_source
Returns
Time source without TIME_SOURCE_RECOVERED set

◆ epoch_time_subseconds()

uint16_t epoch_time_subseconds ( uint64_t epoch_time)
inlinestatic

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>

Extracts epoch subseconds from a complete epoch time.

Parameters
epoch_timeComplete epoch time
Return values
subsecondsFractional component of time since GPS epoch

◆ epoch_time_trusted_source()

bool epoch_time_trusted_source ( enum epoch_time_source source,
bool recovered_ok )
inlinestatic

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>

Determine whether a given time source should be trusted.

Parameters
sourceTime source
recovered_okShould a time source recovered across a reboot be trusted
Returns
true Time source can be trusted
false Time source should not be trusted

◆ epoch_time_unix_calendar()

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.

Note
Output depends on current leap seconds count, and is therefore only valid until the next leap second change.
Parameters
epoch_timeComplete epoch time
calendarOutput calendar

◆ ticks_from_epoch_time()

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.

Parameters
epoch_timeepoch time
Returns
uint64_t Equivalent time in ticks

◆ unix_time_from_epoch()

uint32_t unix_time_from_epoch ( uint64_t epoch_time)
inlinestatic

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/time/epoch.h>

Convert epoch time to current unix time.

Warning
To simplify the implementation, this function is only guaranteed to be correct for times since the last leap second (31st December 2016) until the next leap second (unknown).
Parameters
epoch_timeComplete epoch time
Return values
unix_timeCurrent unix time