datetime.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef _PICO_UTIL_DATETIME_H
8#define _PICO_UTIL_DATETIME_H
9
10#include "pico.h"
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
22#if PICO_INCLUDE_RTC_DATETIME
23#include <time.h>
24
32void datetime_to_str(char *buf, uint buf_size, const datetime_t *t);
33
34bool time_to_datetime(time_t time, datetime_t *dt);
35bool datetime_to_time(const datetime_t *dt, time_t *time);
36#endif
37
38#include <sys/time.h>
39uint64_t timespec_to_ms(const struct timespec *ts);
40uint64_t timespec_to_us(const struct timespec *ts);
41void ms_to_timespec(uint64_t ms, struct timespec *ts);
42void us_to_timespec(uint64_t ms, struct timespec *ts);
43
44#ifdef __cplusplus
45}
46#endif
47#endif
Structure containing date and time information.
Definition: types.h:107