archeus/include/arc/std/time.h

56 lines
1.1 KiB
C
Raw Permalink Normal View History

#ifndef ARC_STD_TIME_H_
#define ARC_STD_TIME_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <time.h>
/**
* @brief the ARC_Time data structre based on time.h (mainly added to avoid having to type `struct tm` every time)
*
* seconds == tm_sec [0,60]
* minutes == tm_min [0,59]
* hour == tm_hour [0,23]
*
* day == tm_yday Day of year [0,365]
* month == tm_mon Month of year [0,11]
* year == tm_year Years since 1900
*
* dayOfWeek == tm_wday Day of week [0,6] (Sunday =0)
* dayOfMonth == tm_mday Day of month [1,31]
*
* daylightSavingsFlag == tm_isdst Daylight Savings flag
*/
typedef struct ARC_Time {
uint8_t seconds;
uint8_t minutes;
uint8_t hour;
uint32_t day;
uint8_t month;
uint32_t year;
uint8_t dayOfWeek;
uint8_t dayOfMonth;
uint8_t daylightSavingsFlag;
} ARC_Time;
/**
* @brief copies the contents of a tm struct pointer into the ARC_Time type
*
* @param time the struct tm type to copy
*
* @return the contents of a struct tm as an ARC_Time
*/
ARC_Time ARC_Time_CopyFromStructTmPtr(struct tm *time);
#ifdef __cplusplus
}
#endif
#endif // !ARC_STD_TIME_H_