Skip to content

Latest commit

 

History

History
85 lines (74 loc) · 2.67 KB

sys_time.md

File metadata and controls

85 lines (74 loc) · 2.67 KB

🏠 Main Page

sys_time - Time Functions

💾File: sys_time.h
📦Library: lib2_sys


Functions:


💠Function: sys_timeout_ms - Timeout function, call in loop to update timeout

bool sys_timeout_ms(uint64_t* tm, uint32_t timeout_ms)
  • ▶️Param: tm timer variable, must init with 0 on start
  • ▶️Param: timeout_ms timeout in ms
  • ✅Return: true if timeout

💠Function: sys_delay_us - Wait microseconds

void sys_delay_us(uint32_t delay_us)
  • ▶️Param: delay_us Delay in us

💠Function: sys_delay_ms - Wait miliseconds

static inline void sys_delay_ms(uint32_t delay_ms)
  • ▶️Param: delay_ms Delay in ms

💠Function: sys_delay_s - Wait seconds

static inline void sys_delay_s(uint32_t delay_s)
  • ▶️Param: delay_us Delay in s

💠Function: sys_check_datetime - Check datetime_t struct for valid values

bool sys_check_datetime(datetime_t *dt)
  • ▶️Param: dt datetime_t to check
  • ✅Return: true if datetime_t valid

💠Function: sys_setrtc - Set system rtc

bool sys_setrtc(datetime_t *dt)
  • ▶️Param: dt Datetime_t to set
  • ✅Return: true if rtc set

💠Function: sys_getrtc - Get system rtc

bool sys_getrtc(datetime_t *dt)
  • ▶️Param: dt Datetime_t to get
  • ✅Return: true if rtc get

💠Function: sys_getrtc_str - Get system rtc as string

void sys_getrtc_str(int8_t* buf, size_t buflen)
  • ▶️Param: buf String buffer
  • ▶️Param: buflen String buffer length

💠Function: sys_getrtc_format - Get system rtc as string formated

Example format: "%H:%M:%S"

For detail format look in C function strftime()

void sys_getrtc_format(int8_t* format, int8_t* buf, size_t buflen)
  • ▶️Param: format Date time format
  • ▶️Param: buf String buffer
  • ▶️Param: buflen String buffer length

💠Function: sys_dayOfWeek - Calultate day of week from date

uint8_t sys_dayOfWeek(datetime_t *dt)
  • ▶️Param: dt Datetime_t to calculate
  • ✅Return: Day of week (0=Sunday)

💠Function: sys_secondsToDate - Convert unix epoch seconds to date time

void sys_secondsToDate(int64_t ts, datetime_t *dt)
  • ▶️Param: ts Seconds since unix epoch
  • ▶️Param: dt Datetime_t to get