Add DateTime struct and datetimePrecision enum
This commit is contained in:
parent
49fdf75c41
commit
b10b4a79d4
3 changed files with 24 additions and 2 deletions
3
Makefile
3
Makefile
|
@ -43,6 +43,7 @@ CFLAGS += -fPIC
|
||||||
|
|
||||||
hdrs += include/epoch.h
|
hdrs += include/epoch.h
|
||||||
|
|
||||||
|
srcs += datetime.c
|
||||||
srcs += epoch.c
|
srcs += epoch.c
|
||||||
srcs += month.c
|
srcs += month.c
|
||||||
srcs += weekday.c
|
srcs += weekday.c
|
||||||
|
@ -86,7 +87,7 @@ testclean:
|
||||||
$(MAKE) -C test clean
|
$(MAKE) -C test clean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.a *.so *.o haggis
|
rm -rf *.a *.so *.o
|
||||||
$(MAKE) -C test clean
|
$(MAKE) -C test clean
|
||||||
|
|
||||||
.PHONY: all shared static clean install install_include install_static \
|
.PHONY: all shared static clean install install_include install_static \
|
||||||
|
|
0
datetime.c
Normal file
0
datetime.c
Normal file
|
@ -63,6 +63,27 @@ typedef struct {
|
||||||
TzOffset *offset;
|
TzOffset *offset;
|
||||||
} TimeZone;
|
} TimeZone;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Year year;
|
||||||
|
Month month;
|
||||||
|
uint8_t day;
|
||||||
|
uint8_t hour;
|
||||||
|
uint8_t minute;
|
||||||
|
uint8_t second;
|
||||||
|
int64_t microseconds;
|
||||||
|
TimeZone zone;
|
||||||
|
} DateTime;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
YearPrecision,
|
||||||
|
MonthPrecision,
|
||||||
|
DayPrecision,
|
||||||
|
HourPrecision,
|
||||||
|
MinutePrecision,
|
||||||
|
SecondPrecision,
|
||||||
|
MicrosecondPrecision,
|
||||||
|
} datetimePrecision;
|
||||||
|
|
||||||
void yearNew(Year *year, int32_t inner);
|
void yearNew(Year *year, int32_t inner);
|
||||||
uint16_t yearGetDays(Year *year);
|
uint16_t yearGetDays(Year *year);
|
||||||
int64_t yearGetSeconds(Year *year);
|
int64_t yearGetSeconds(Year *year);
|
||||||
|
|
Loading…
Add table
Reference in a new issue