Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support both struct timespec and struct tm variants of the aon timer APIs #2079

Merged
merged 7 commits into from
Nov 22, 2024
13 changes: 10 additions & 3 deletions src/common/pico_util/datetime.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
#include "pico/util/datetime.h"

#include <stdio.h>
#if !PICO_ON_DEVICE && __APPLE__
// if we're compiling with LLVM on Apple, __weak does something else, but we don't care about overriding these ayway
#define __datetime_weak
#else
#define __datetime_weak __weak
#endif

struct tm * __weak pico_localtime_r(const time_t *time, struct tm *tm) {
__datetime_weak struct tm * pico_localtime_r(const time_t *time, struct tm *tm) {
kilograham marked this conversation as resolved.
Show resolved Hide resolved
return localtime_r(time, tm);
}

time_t __weak pico_mktime(struct tm *tm) {
__datetime_weak time_t pico_mktime(struct tm *tm) {
return mktime(tm);
}

#if PICO_INCLUDE_RTC_DATETIME
#include <stdio.h>

static const char *DATETIME_MONTHS[12] = {
"January",
"February",
Expand Down