Awesome
COG-UTILS
General purpose utility functions aimed at portability, used by Concord.
API
File operation
cog_load_whole_file_fp()
- Load file contents into a string (provide aFILE*
)cog_load_whole_file()
- Load file contents into a string
Time
cog_timezone()
- Get your local timezone (difference between UTC and local time in seconds)cog_sleep_ms()
- Sleep for milliseconds amountcog_sleep_us()
- Sleep for microseconds amountcog_timestamp_ms()
- Get the current timestamp in millisecondscog_timestamp_us()
- Get the current timestamp in microseconds
Conversion
cog_iso8601_to_unix_ms()
- Convert a iso8601 string to unix timestamp (milliseconds)cog_unix_ms_to_iso8601()
- Convert a unix timestamp (milliseconds) to a iso8601 stringcog_strtou64()
- Convert a numerical string touint64_t
cog_u64tostr()
- Convertuint64_t
to a numerical string
Wrappers
cog_strndup()
- analogous to strndup()cog_asprintf()
- analogous to asprintf()
Other info
This software is distributed under MIT license, so feel free to integrate it in your commercial products.