aboutsummaryrefslogtreecommitdiffstats
path: root/core/subsurface-time.h
blob: 8d564753fd2625e036befb1968276cf58038e69a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// SPDX-License-Identifier: GPL-2.0
#ifndef TIME_H
#define TIME_H

#include "units.h"
#include <time.h>

#ifdef __cplusplus
extern "C" {
#endif

extern timestamp_t utc_mktime(struct tm *tm);
extern void utc_mkdate(timestamp_t, struct tm *tm);
extern int utc_year(timestamp_t timestamp);
extern int utc_weekday(timestamp_t timestamp);

/* 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 */
extern char *format_datetime(timestamp_t timestamp); /* ownership of string passed to caller */

#ifdef __cplusplus
}
#endif

#endif