-
Notifications
You must be signed in to change notification settings - Fork 0
/
date_time.h
74 lines (61 loc) · 2.28 KB
/
date_time.h
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 - 2022 TheVice
*
*/
#ifndef _DATE_TIME_H_
#define _DATE_TIME_H_
#include <stdint.h>
struct range;
uint8_t datetime_format_to_string(
int64_t input, const uint8_t* format, void* output);
uint8_t datetime_parse(
const uint8_t* input_start, const uint8_t* input_finish,
uint32_t* year, uint8_t* month, uint8_t* day,
uint8_t* hour, uint8_t* minute, uint8_t* second);
uint8_t datetime_parse_range(const struct range* input, int64_t* output);
uint8_t datetime_to_string(
uint32_t year, uint8_t month, uint8_t day,
uint8_t hour, uint8_t minute, uint8_t second,
void* output);
uint8_t datetime_get_day(int64_t input);
uint8_t datetime_get_day_of_week(int64_t input);
uint16_t datetime_get_day_of_year(int64_t input);
uint8_t datetime_get_days_in_month(uint32_t year, uint8_t month);
uint8_t datetime_get_hour(int64_t input);
/*uint16_t datetime_get_millisecond(int64_t input);*/
uint8_t datetime_get_minute(int64_t input);
uint8_t datetime_get_month(int64_t input);
uint8_t datetime_get_second(int64_t input);
/*int64_t datetime_get_ticks(int64_t input);*/
uint32_t datetime_get_year(int64_t input);
uint8_t datetime_is_leap_year(uint32_t year);
int64_t datetime_ticks();
int64_t datetime_now_utc();
int64_t datetime_now();
int64_t datetime_encode(
uint32_t year, uint8_t month, uint8_t day,
uint8_t hour, uint8_t minute, uint8_t second);
uint8_t datetime_decode(
int64_t time, uint32_t* year, uint8_t* month, uint8_t* day,
uint8_t* hour, uint8_t* minute, uint8_t* second, uint16_t* year_day);
#if !defined(_WIN32)
long datetime_get_bias();
#endif
int64_t date_time_millisecond_to_second(uint64_t millisecond);
int64_t timespan_from_days(double input);
int64_t timespan_from_hours(double input);
int64_t timespan_from_milliseconds(double input);
int64_t timespan_from_minutes(double input);
int64_t timespan_from_seconds(double input);
int64_t timespan_from_ticks(int64_t ticks);
int32_t timespan_get_days(int64_t input);
int32_t timespan_get_hours(int64_t input);
int32_t timespan_get_minutes(int64_t input);
int64_t timespan_get_ticks(int64_t input);
double timespan_get_total_days(int64_t input);
double timespan_get_total_hours(int64_t input);
int64_t timespan_get_total_milliseconds(int64_t input);
double timespan_get_total_minutes(int64_t input);
#endif