Add timespec_{read,write}_file() and unit tests

This commit is contained in:
Pim van Pelt
2018-11-04 17:40:12 +01:00
parent 5b79487ab8
commit f5ea934dfb
4 changed files with 110 additions and 1 deletions

View File

@ -1,5 +1,6 @@
#pragma once
#include "mgos.h"
#include <unistd.h>
/* A simple time specifier for windows of time throughout a 24 hour day.
*
@ -47,3 +48,7 @@ bool timespec_clear_spec(struct mgos_timespec *ts);
bool timespec_get_spec(struct mgos_timespec *ts, char *ret, int retlen);
bool timespec_match(const struct mgos_timespec *ts, const struct tm *tm);
bool timespec_match_now(const struct mgos_timespec *ts);
// File IO -- read or write the current timespec to a file
bool timespec_write_file(struct mgos_timespec *ts, const char *fn);
bool timespec_read_file(struct mgos_timespec *ts, const char *fn);