Haka: include/haka/time.h Source File

Haka

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

time.h
Go to the documentation of this file.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
10 #ifndef HAKA_TIME_H
11 #define HAKA_TIME_H
12
13 #include <haka/types.h>
14
15 #include <time.h>
16
17
21 struct time {
22 time_t secs;
23 uint32 nsecs;
24 };
25
26 #define TIME_BUFSIZE 27
27 #define INVALID_TIME { 0, 0 }
29 extern const struct time invalid_time;
30
34 void time_build(struct time *t, double secs);
35
39 bool time_gettimestamp(struct time *t);
40
44 void time_add(struct time *res, const struct time *t1, const struct time *t2);
45
50 int time_diff(struct time *res, const struct time *t1, const struct time *t2);
51
55 uint64 time_divide(const struct time *t1, const struct time *t2);
56
60 void time_mult(struct time *res, const struct time *t1, const int mult);
61
66 int time_cmp(const struct time *t1, const struct time *t2);
67
71 double time_sec(const struct time *t);
72
77 bool time_tostring(const struct time *t, char *buffer, size_t len);
78
83 bool time_format(const struct time *t, const char *format, char *buffer, size_t len);
84
88 bool time_isvalid(const struct time *t);
89
90 #endif /* HAKA_TIME_H */
time_divide
uint64 time_divide(const struct time *t1, const struct time *t2)
Definition: time.c:75
types.h
time::nsecs
uint32 nsecs
Definition: time.h:23
time.h
time_mult
void time_mult(struct time *res, const struct time *t1, const int mult)
Definition: time.c:82
uint64
unsigned HAKA_64BIT_TYPE uint64
Definition: types.h:30
uint32
unsigned HAKA_32BIT_TYPE uint32
Definition: types.h:29
time_gettimestamp
bool time_gettimestamp(struct time *t)
Definition: time.c:26
time_cmp
int time_cmp(const struct time *t1, const struct time *t2)
Definition: time.c:96
time_diff
int time_diff(struct time *res, const struct time *t1, const struct time *t2)
Definition: time.c:63
time_format
bool time_format(const struct time *t, const char *format, char *buffer, size_t len)
Definition: time.c:131
time_sec
double time_sec(const struct time *t)
Definition: time.c:91
time
Definition: time.h:21
time::secs
time_t secs
Definition: time.h:22
time_add
void time_add(struct time *res, const struct time *t1, const struct time *t2)
Definition: time.c:39
time_tostring
bool time_tostring(const struct time *t, char *buffer, size_t len)
Definition: time.c:117
time_isvalid
bool time_isvalid(const struct time *t)
Definition: time.c:146
time_build
void time_build(struct time *t, double secs)
Definition: time.c:20