2020-05-01 12:07:59 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#ifndef TIME_H
|
|
|
|
#define TIME_H
|
|
|
|
|
|
|
|
#include "units.h"
|
2024-05-04 15:55:50 +00:00
|
|
|
#include <string>
|
2020-05-01 12:07:59 +00:00
|
|
|
#include <time.h>
|
|
|
|
|
2020-11-01 20:44:30 +00:00
|
|
|
extern timestamp_t utc_mktime(const struct tm *tm);
|
2020-05-01 12:07:59 +00:00
|
|
|
extern void utc_mkdate(timestamp_t, struct tm *tm);
|
2020-05-23 09:59:53 +00:00
|
|
|
extern int utc_year(timestamp_t timestamp);
|
|
|
|
extern int utc_weekday(timestamp_t timestamp);
|
2020-05-01 12:07:59 +00:00
|
|
|
|
2020-08-27 05:10:33 +00:00
|
|
|
/* parse and format date times of the form YYYY-MM-DD hh:mm:ss */
|
|
|
|
extern timestamp_t parse_datetime(const char *s); /* returns 0 on error */
|
2020-12-08 12:32:46 +00:00
|
|
|
extern const char *monthname(int mon);
|
|
|
|
|
2024-02-29 10:31:46 +00:00
|
|
|
std::string format_datetime(timestamp_t timestamp); /* ownership of string passed to caller */
|
|
|
|
|
2020-05-01 12:07:59 +00:00
|
|
|
#endif
|