hc
2023-05-26 a23f51ed7a39e452c1037343a84d7db1ca2c5bd7
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
#ifndef OS_TIME_H
#define OS_TIME_H
#ifdef __cplusplus
extern "C" {
#endif
 
#include <stdlib.h>
 
typedef enum {
    OS_TIME_TYPE_CLOCK,
    OS_TIME_TYPE_SECOND,
    OS_TIME_TYPE_MILLISECOND
} os_time_type_t;
 
typedef struct {
    union {
        struct {
            int year;
            int month;
            int day;
            int hour;
            int minute;
            int second;
            int millisecond;
            int week;
            int year_day;
        } clock;
        size_t second;
        size_t millisecond;
    };  
    os_time_type_t type;
}os_time_t;
 
int os_time_now(os_time_t *timestamp);
 
#ifdef __cplusplus
}
#endif
#endif