Concord - C Discord API library
A Discord API wrapper library written in C
cog-utils.h
Go to the documentation of this file.
1#ifndef COG_UTILS_H
2#define COG_UTILS_H
3
4#include <stdio.h>
5#include <stdint.h>
6
7#ifdef __cplusplus
8extern "C" {
9#endif /* __cplusplus */
10
18char *cog_load_whole_file_fp(FILE *fp, size_t *len);
28char *cog_load_whole_file(const char filename[], size_t *len);
29
35long cog_timezone(void);
36
47int cog_iso8601_to_unix_ms(const char str[], size_t len, uint64_t *p_value);
48
57int cog_unix_ms_to_iso8601(char str[], size_t len, const uint64_t value);
58
68int cog_strtou64(char *str, size_t len, uint64_t *p_value);
69
78int cog_u64tostr(char *str, size_t len, uint64_t *p_value);
79
89size_t cog_strndup(const char src[], size_t len, char **p_dest);
90
100size_t cog_asprintf(char **strp, const char fmt[], ...);
101
108int cog_sleep_ms(const long tms);
109
116int cog_sleep_us(const long tms);
117
123uint64_t cog_timestamp_ms(void);
124
130uint64_t cog_timestamp_us(void);
131
132#ifdef __cplusplus
133}
134#endif /* __cplusplus */
135
136#endif /* COG_UTILS_H */
int cog_u64tostr(char *str, size_t len, uint64_t *p_value)
Convert uint64_t to a numerical string.
int cog_sleep_ms(const long tms)
Sleep for amount of milliseconds.
long cog_timezone(void)
Get the difference between UTC and the latest local standard time, in seconds.
char * cog_load_whole_file_fp(FILE *fp, size_t *len)
Load file contents into a string.
int cog_iso8601_to_unix_ms(const char str[], size_t len, uint64_t *p_value)
Convert a iso8601 string to a unix timestamp (milliseconds)
int cog_unix_ms_to_iso8601(char str[], size_t len, const uint64_t value)
Convert a unix timestamp (milliseconds) to a iso8601 string.
char * cog_load_whole_file(const char filename[], size_t *len)
Load file contents into a string.
int cog_strtou64(char *str, size_t len, uint64_t *p_value)
Convert a numerical string to uint64_t
size_t cog_asprintf(char **strp, const char fmt[],...)
Copies at most len bytes of src to *p_dest.
size_t cog_strndup(const char src[], size_t len, char **p_dest)
Copies at most len bytes of src to *p_dest.
uint64_t cog_timestamp_us(void)
Get the current timestamp in microseconds.
uint64_t cog_timestamp_ms(void)
Get the current timestamp in milliseconds.
int cog_sleep_us(const long tms)
Sleep for amount of microseconds.