66 lines
881 B
C
66 lines
881 B
C
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
* Copyright (c) Camden Dixie O'Brien
|
|
*/
|
|
|
|
#ifndef TIME_MANAGER_H
|
|
#define TIME_MANAGER_H
|
|
|
|
typedef struct {
|
|
unsigned hour;
|
|
unsigned minute;
|
|
} Time;
|
|
|
|
typedef struct {
|
|
unsigned year;
|
|
unsigned month;
|
|
unsigned day;
|
|
} Date;
|
|
|
|
typedef enum {
|
|
WEEK_DAY_MONDAY,
|
|
WEEK_DAY_TUESDAY,
|
|
WEEK_DAY_WEDNESDAY,
|
|
WEEK_DAY_THURSDAY,
|
|
WEEK_DAY_FRIDAY,
|
|
WEEK_DAY_SATURDAY,
|
|
WEEK_DAY_SUNDAY,
|
|
} WeekDay;
|
|
|
|
/**
|
|
* Initialize the time module.
|
|
*/
|
|
void time_manager_init(void);
|
|
|
|
/**
|
|
* Get the current time.
|
|
*/
|
|
Time get_time(void);
|
|
|
|
/**
|
|
* Set the time.
|
|
*/
|
|
void set_time(Time time);
|
|
|
|
/**
|
|
* Get the current date.
|
|
*/
|
|
Date get_date(void);
|
|
|
|
/**
|
|
* Set the date.
|
|
*/
|
|
void set_date(Date date);
|
|
|
|
/**
|
|
* Get which day of the week it is.
|
|
*/
|
|
WeekDay get_week_day(void);
|
|
|
|
/**
|
|
* Get the name of a day of the week.
|
|
*/
|
|
const char *week_day_name(WeekDay day);
|
|
|
|
#endif
|