Find file
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (22 sloc) 623 Bytes


Convert strings like "15s" to seconds, milliseconds, or microseconds, and convert milliseconds to strings ("300ms", "5ms") or long strings ("5 seconds", "1 month").


Install with clib:

$ clib install clibs/ms


long long
string_to_microseconds(const char *str);

long long
string_to_milliseconds(const char *str);

long long
string_to_seconds(const char *str);

char *
milliseconds_to_string(long long ms);

char *
milliseconds_to_long_string(long long ms);

For usage view the tests