LibJuno 0.42.0
LibJuno is a lightweight C99 library designed specifically for embedded systems.
Loading...
Searching...
No Matches
time_api.h File Reference
#include "juno/status.h"
#include "juno/module.h"
#include "juno/types.h"
#include <stddef.h>
#include <stdint.h>
Include dependency graph for time_api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  JUNO_TIMESTAMP_TAG
 
struct  JUNO_TIME_API_TAG
 

Macros

#define JUNO_TIME_NEW_API(Now, SleepTo, Sleep)
 

Typedefs

typedef struct JUNO_TIME_API_TAG JUNO_TIME_API_T
 
typedef union JUNO_TIME_TAG JUNO_TIME_T
 
typedef struct JUNO_TIME_ROOT_TAG JUNO_TIME_ROOT_T
 
typedef struct JUNO_TIMESTAMP_TAG JUNO_TIMESTAMP_T
 
typedef uint64_t JUNO_TIME_SECONDS_T
 
typedef uint64_t JUNO_TIME_MILLIS_T
 
typedef uint64_t JUNO_TIME_MICROS_T
 
typedef uint64_t JUNO_TIME_NANOS_T
 
typedef uint64_t JUNO_TIME_SUBSECONDS_T
 

Functions

struct JUNO_TIME_ROOT_TAG JUNO_MODULE_ROOT (JUNO_TIME_API_T, JUNO_MODULE_EMPTY)
 This is the Juno Time Module for all time time related operations. Some of the time API function implementations may be very implementation specific, so be consciencous of the implementation.
 
 JUNO_MODULE_RESULT (JUNO_TIMESTAMP_RESULT_T, JUNO_TIMESTAMP_T)
 
 JUNO_MODULE_RESULT (JUNO_TIME_SECONDS_RESULT_T, JUNO_TIME_SECONDS_T)
 
 JUNO_MODULE_RESULT (JUNO_TIME_MILLIS_RESULT_T, JUNO_TIME_MILLIS_T)
 
 JUNO_MODULE_RESULT (JUNO_TIME_MICROS_RESULT_T, JUNO_TIME_MICROS_T)
 
 JUNO_MODULE_RESULT (JUNO_TIME_NANOS_RESULT_T, JUNO_TIME_NANOS_T)
 
 JUNO_MODULE_RESULT (JUNO_TIME_SUBSECONDS_RESULT_T, JUNO_TIME_SUBSECONDS_T)
 
JUNO_STATUS_T JunoTime_AddTime (JUNO_TIME_T *ptTime, JUNO_TIMESTAMP_T *ptRetTime, JUNO_TIMESTAMP_T tTimeToAdd)
 
JUNO_STATUS_T JunoTime_SubtractTime (JUNO_TIME_T *ptTime, JUNO_TIMESTAMP_T *ptRetTime, JUNO_TIMESTAMP_T tTimeToSubtract)
 
JUNO_TIME_NANOS_RESULT_T JunoTime_TimestampToNanos (JUNO_TIME_T *ptTime, JUNO_TIMESTAMP_T tTime)
 
JUNO_TIME_MICROS_RESULT_T JunoTime_TimestampToMicros (JUNO_TIME_T *ptTime, JUNO_TIMESTAMP_T tTime)
 
JUNO_TIME_MILLIS_RESULT_T JunoTime_TimestampToMillis (JUNO_TIME_T *ptTime, JUNO_TIMESTAMP_T tTime)
 
JUNO_TIMESTAMP_RESULT_T JunoTime_NanosToTimestamp (JUNO_TIME_T *ptTime, JUNO_TIME_NANOS_T iNanos)
 
JUNO_TIMESTAMP_RESULT_T JunoTime_MicrosToTimestamp (JUNO_TIME_T *ptTime, JUNO_TIME_MICROS_T iMicros)
 
JUNO_TIMESTAMP_RESULT_T JunoTime_MillisToTimestamp (JUNO_TIME_T *ptTime, JUNO_TIME_MILLIS_T iMillis)
 
JUNO_RESULT_F64_T JunoTime_TimestampToDouble (JUNO_TIME_T *ptTime, JUNO_TIMESTAMP_T tTimestamp)
 
JUNO_TIMESTAMP_RESULT_T JunoTime_DoubleToTimestamp (JUNO_TIME_T *ptTime, double dTimestamp)
 
static bool JunoTime_TimestampGreaterThan (JUNO_TIMESTAMP_T tLeft, JUNO_TIMESTAMP_T tRight)
 
static bool JunoTime_TimestampLessThan (JUNO_TIMESTAMP_T tLeft, JUNO_TIMESTAMP_T tRight)
 
static bool JunoTime_TimestampEquals (JUNO_TIMESTAMP_T tLeft, JUNO_TIMESTAMP_T tRight)
 

Macro Definition Documentation

◆ JUNO_TIME_NEW_API

#define JUNO_TIME_NEW_API (   Now,
  SleepTo,
  Sleep 
)
Value:
{ \
Now, \
SleepTo, \
Sleep, \
}
JUNO_TIME_MICROS_RESULT_T JunoTime_TimestampToMicros(JUNO_TIME_T *ptTime, JUNO_TIMESTAMP_T tTime)
Definition juno_time.c:82
JUNO_TIMESTAMP_RESULT_T JunoTime_MicrosToTimestamp(JUNO_TIME_T *ptTime, JUNO_TIME_MICROS_T iMicros)
Definition juno_time.c:146
JUNO_TIMESTAMP_RESULT_T JunoTime_MillisToTimestamp(JUNO_TIME_T *ptTime, JUNO_TIME_MILLIS_T iMillis)
Definition juno_time.c:162
JUNO_TIME_NANOS_RESULT_T JunoTime_TimestampToNanos(JUNO_TIME_T *ptTime, JUNO_TIMESTAMP_T tTime)
Definition juno_time.c:58
JUNO_STATUS_T JunoTime_AddTime(JUNO_TIME_T *ptTime, JUNO_TIMESTAMP_T *ptRetTime, JUNO_TIMESTAMP_T tTimeToAdd)
Definition juno_time.c:8
JUNO_STATUS_T JunoTime_SubtractTime(JUNO_TIME_T *ptTime, JUNO_TIMESTAMP_T *ptRetTime, JUNO_TIMESTAMP_T tTimeToSubtract)
Definition juno_time.c:30
JUNO_TIMESTAMP_RESULT_T JunoTime_DoubleToTimestamp(JUNO_TIME_T *ptTime, double dTimestamp)
Definition juno_time.c:193
JUNO_TIMESTAMP_RESULT_T JunoTime_NanosToTimestamp(JUNO_TIME_T *ptTime, JUNO_TIME_NANOS_T iNanos)
Definition juno_time.c:130
JUNO_RESULT_F64_T JunoTime_TimestampToDouble(JUNO_TIME_T *ptTime, JUNO_TIMESTAMP_T tTimestamp)
Definition juno_time.c:179
JUNO_TIME_MILLIS_RESULT_T JunoTime_TimestampToMillis(JUNO_TIME_T *ptTime, JUNO_TIMESTAMP_T tTime)
Definition juno_time.c:106

Typedef Documentation

◆ JUNO_TIME_API_T

This header contains the time library API

Author
Robin Onsay

◆ JUNO_TIME_MICROS_T

typedef uint64_t JUNO_TIME_MICROS_T

◆ JUNO_TIME_MILLIS_T

typedef uint64_t JUNO_TIME_MILLIS_T

◆ JUNO_TIME_NANOS_T

typedef uint64_t JUNO_TIME_NANOS_T

◆ JUNO_TIME_ROOT_T

typedef struct JUNO_TIME_ROOT_TAG JUNO_TIME_ROOT_T

◆ JUNO_TIME_SECONDS_T

typedef uint64_t JUNO_TIME_SECONDS_T

◆ JUNO_TIME_SUBSECONDS_T

typedef uint64_t JUNO_TIME_SUBSECONDS_T

◆ JUNO_TIME_T

typedef union JUNO_TIME_TAG JUNO_TIME_T

◆ JUNO_TIMESTAMP_T

Function Documentation

◆ JUNO_MODULE_RESULT() [1/6]

JUNO_MODULE_RESULT ( JUNO_TIME_MICROS_RESULT_T  ,
JUNO_TIME_MICROS_T   
)

◆ JUNO_MODULE_RESULT() [2/6]

JUNO_MODULE_RESULT ( JUNO_TIME_MILLIS_RESULT_T  ,
JUNO_TIME_MILLIS_T   
)

◆ JUNO_MODULE_RESULT() [3/6]

JUNO_MODULE_RESULT ( JUNO_TIME_NANOS_RESULT_T  ,
JUNO_TIME_NANOS_T   
)

◆ JUNO_MODULE_RESULT() [4/6]

JUNO_MODULE_RESULT ( JUNO_TIME_SECONDS_RESULT_T  ,
JUNO_TIME_SECONDS_T   
)

◆ JUNO_MODULE_RESULT() [5/6]

JUNO_MODULE_RESULT ( JUNO_TIME_SUBSECONDS_RESULT_T  ,
JUNO_TIME_SUBSECONDS_T   
)

◆ JUNO_MODULE_RESULT() [6/6]

JUNO_MODULE_RESULT ( JUNO_TIMESTAMP_RESULT_T  ,
JUNO_TIMESTAMP_T   
)

◆ JUNO_MODULE_ROOT()

struct JUNO_TIME_ROOT_TAG JUNO_MODULE_ROOT ( JUNO_TIME_API_T  ,
JUNO_MODULE_EMPTY   
)

This is the Juno Time Module for all time time related operations. Some of the time API function implementations may be very implementation specific, so be consciencous of the implementation.

Certain operations regarding time math are implemented by LibJuno for module developers to include: JunoTime_AddTime JunoTime_SubtractTime JunoTime_TimestampToNanos JunoTime_TimestampToMicros JunoTime_TimestampToMillis JunoTime_NanosToTimestamp JunoTime_MicrosToTimestamp JunoTime_MillisToTimestamp

◆ JunoTime_AddTime()

JUNO_STATUS_T JunoTime_AddTime ( JUNO_TIME_T ptTime,
JUNO_TIMESTAMP_T ptRetTime,
JUNO_TIMESTAMP_T  tTimeToAdd 
)

◆ JunoTime_DoubleToTimestamp()

JUNO_TIMESTAMP_RESULT_T JunoTime_DoubleToTimestamp ( JUNO_TIME_T ptTime,
double  dTimestamp 
)

◆ JunoTime_MicrosToTimestamp()

JUNO_TIMESTAMP_RESULT_T JunoTime_MicrosToTimestamp ( JUNO_TIME_T ptTime,
JUNO_TIME_MICROS_T  iMicros 
)

◆ JunoTime_MillisToTimestamp()

JUNO_TIMESTAMP_RESULT_T JunoTime_MillisToTimestamp ( JUNO_TIME_T ptTime,
JUNO_TIME_MILLIS_T  iMillis 
)

◆ JunoTime_NanosToTimestamp()

JUNO_TIMESTAMP_RESULT_T JunoTime_NanosToTimestamp ( JUNO_TIME_T ptTime,
JUNO_TIME_NANOS_T  iNanos 
)

◆ JunoTime_SubtractTime()

JUNO_STATUS_T JunoTime_SubtractTime ( JUNO_TIME_T ptTime,
JUNO_TIMESTAMP_T ptRetTime,
JUNO_TIMESTAMP_T  tTimeToSubtract 
)

◆ JunoTime_TimestampEquals()

static bool JunoTime_TimestampEquals ( JUNO_TIMESTAMP_T  tLeft,
JUNO_TIMESTAMP_T  tRight 
)
inlinestatic

◆ JunoTime_TimestampGreaterThan()

static bool JunoTime_TimestampGreaterThan ( JUNO_TIMESTAMP_T  tLeft,
JUNO_TIMESTAMP_T  tRight 
)
inlinestatic

◆ JunoTime_TimestampLessThan()

static bool JunoTime_TimestampLessThan ( JUNO_TIMESTAMP_T  tLeft,
JUNO_TIMESTAMP_T  tRight 
)
inlinestatic

◆ JunoTime_TimestampToDouble()

JUNO_RESULT_F64_T JunoTime_TimestampToDouble ( JUNO_TIME_T ptTime,
JUNO_TIMESTAMP_T  tTimestamp 
)

◆ JunoTime_TimestampToMicros()

JUNO_TIME_MICROS_RESULT_T JunoTime_TimestampToMicros ( JUNO_TIME_T ptTime,
JUNO_TIMESTAMP_T  tTime 
)

◆ JunoTime_TimestampToMillis()

JUNO_TIME_MILLIS_RESULT_T JunoTime_TimestampToMillis ( JUNO_TIME_T ptTime,
JUNO_TIMESTAMP_T  tTime 
)

◆ JunoTime_TimestampToNanos()

JUNO_TIME_NANOS_RESULT_T JunoTime_TimestampToNanos ( JUNO_TIME_T ptTime,
JUNO_TIMESTAMP_T  tTime 
)