-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathapproxidate.h
More file actions
26 lines (24 loc) · 784 Bytes
/
approxidate.h
File metadata and controls
26 lines (24 loc) · 784 Bytes
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
26
#pragma once
#include <sys/time.h>
/**
* Get a unix timestamp from an arbitrary date string.
*
* If the given date string is missing any parts (date, time, etc), those parts
* will be filled in from the current time.
*
* Returns -1 on parse failure, 0 on success.
*/
int approxidate(const char* date, struct timeval* tv);
/**
* Get a unix timestamp from an arbitrary date string.
*
* Functions much like approxidate, except that if the given date string is
* missing any parts (date, time, etc), those parts will be filled in from the
* relative_to value; if relative_to is NULL, then now is used.
*
* Returns -1 on parse failure, 0 on success.
*/
int approxidate_relative(
const char* date,
struct timeval* tv,
const struct timeval* relative_to);