implemented DateTime struct

This commit is contained in:
2025-11-13 05:11:35 +05:00
parent 1775b27980
commit af36bab444
3 changed files with 51 additions and 1 deletions

View File

@@ -27,6 +27,31 @@ void sleepNsec(nsec_t time);
void sleepUsec(usec_t time);
void sleepMsec(msec_t time);
typedef struct Time {
i32 nsec;
i8 sec;
i8 min;
i8 hour;
} Time;
typedef struct Date {
i8 month_day;
i8 month;
i16 year;
i8 week_day;
i16 year_day;
} Date;
typedef struct DateTime {
Date d;
Time t;
} DateTime;
void DateTime_get(DateTime* dt, bool utc_time);
static inline void DateTime_getLocal(DateTime* dt) { DateTime_get(dt, false); }
static inline void DateTime_getUTC(DateTime* dt) { DateTime_get(dt, true); }
#if __cplusplus
}
#endif