NVR: Get/set time functions now take a void pointer, so nvr.h can be included without requiring time.h.

This commit is contained in:
OBattler
2025-01-23 10:31:31 +01:00
parent 78edf7340c
commit 714eadfc3a
2 changed files with 13 additions and 10 deletions

View File

@@ -114,8 +114,8 @@ extern int nvr_save(void);
extern int nvr_is_leap(int year);
extern int nvr_get_days(int month, int year);
extern void nvr_time_sync(void);
extern void nvr_time_get(struct tm *);
extern void nvr_time_set(struct tm *);
extern void nvr_time_get(void *priv);
extern void nvr_time_set(void *priv);
extern void nvr_reg_write(uint16_t reg, uint8_t val, void *priv);
extern void nvr_at_handler(int set, uint16_t base, nvr_t *nvr);

View File

@@ -326,14 +326,15 @@ nvr_time_sync(void)
/* Get current time from internal clock. */
void
nvr_time_get(struct tm *tm)
nvr_time_get(void *priv)
{
uint8_t dom;
uint8_t mon;
uint8_t sum;
uint8_t wd;
uint16_t cent;
uint16_t yr;
struct tm *tm = (struct tm *) priv;
uint8_t dom;
uint8_t mon;
uint8_t sum;
uint8_t wd;
uint16_t cent;
uint16_t yr;
tm->tm_sec = intclk.tm_sec;
tm->tm_min = intclk.tm_min;
@@ -352,8 +353,10 @@ nvr_time_get(struct tm *tm)
/* Set internal clock time. */
void
nvr_time_set(struct tm *tm)
nvr_time_set(void *priv)
{
struct tm *tm = (struct tm *) priv;
intclk.tm_sec = tm->tm_sec;
intclk.tm_min = tm->tm_min;
intclk.tm_hour = tm->tm_hour;